input box

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
821
Office Version
  1. 365
Platform
  1. Windows
Hi
What am I doing wrong????
this works
HTML:
Sub box()
Name = InputBox("name", 3)
Range("A1").Value = name
End Sub


and this doesn't
HTML:
Sub box1()
Name = InputBox("Start", 3)
Range("A1").Value = Start
End Sub

mike
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You are trying to use Start as a variable for name, when "Start" is simply the title of the InputBox

Code:
Sub box1()
Name = InputBox("Start", 3)
Range("A1").Value = [color=red]Start[/color] 'change to Name variable
End Sub
 
Upvote 0
Duh...I couldn't see the forest because of all the trees :)

Thank you

I'll post this question under a different tittle if needed:

is there a way to make this work?
HTML:
Application.Goto Reference:=  >>>>what IS in A1<<<<

The user will put a cell number (example--F480) in the input box
then I want the cursor to go to that cell
then I have a macro to continue


mike
 
Last edited:
Upvote 0
Like this ??
Code:
Sub box1()
n = InputBox("Start", 4)
Range(n).Select
End Sub
 
Upvote 0
Hi Michael M

Yep, that's what I need.

A minor point....I had to change the sub name because every time I clicked on it, the cursor would go to cell>>>BOX1.

Thank you for the help

mike
 
Upvote 0
Yeah, try to avoid using any Sub names or Variable names that VBA might confuse as Native commands..:beerchug:
 
Upvote 0
I remembered that after the cursor kept going to BOX1 :)

Is it possible to have the input box have a default of B so when the user enters the cell number he/she doesn't have to put in the letter. It will always be in B row


mike

sorry about adding questions but i'm only thinking of them as i write the code


mike
 
Upvote 0
Just input number only

Code:
Sub location()
n = InputBox("Start", 3)
Range("B" & n).Select
End Sub
 
Upvote 0
Thank you Michael

works perfectly.

I added an error line to exit the macro

That will be enough tonight. Its 9:30 here..PM

I'll probably have more questions when I add the other macros to it.

Thanks again and Merry Christmas :beerchug::beerchug:


mike



"If that offends, think of it as a generic term for this time of year" :smile:
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top