Two Input Boxes

BuffaloGuy

New Member
Joined
Dec 5, 2017
Messages
42
Office Version
  1. 365
Platform
  1. Windows
I have a table where the first column is always full, and the next nine columns are empty and could fill on a case by case basis. I have a click button that asks to type the address in an input box that I want in cell L3 and after it is entered I have a second input box that would put the city, state, zip in L4. If you click the button again, the next should go in M3, M4 respectively and so on (the table is in K3:T4). I was just testing the getting the first one to work before getting the second set to work and I can't get that far with my current knowledge base. All help is welcome.
VBA Code:
Sub Location_Click()

    Dim AddressStreet As Variant
    Dim CityStateZip As Variant
    
    AddressStreet = InputBox("Enter Business Address:")
    Range("Notes!L3").Value = AddressStreet
    
    CityStateZip = InputBox("Enter Business Address:")
    Range("Notes!L4").Value = CityStateZip
    
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I have a table where the first column is always full, and the next nine columns are empty and could fill on a case by case basis. I have a click button that asks to type the address in an input box that I want in cell L3 and after it is entered I have a second input box that would put the city, state, zip in L4. If you click the button again, the next should go in M3, M4 respectively and so on (the table is in K3:T4). I was just testing the getting the first one to work before getting the second set to work and I can't get that far with my current knowledge base. All help is welcome.
VBA Code:
Sub Location_Click()

    Dim AddressStreet As Variant
    Dim CityStateZip As Variant
 
    AddressStreet = InputBox("Enter Business Address:")
    Range("Notes!L3").Value = AddressStreet
 
    CityStateZip = InputBox("Enter Business Address:")
    Range("Notes!L4").Value = CityStateZip
 
End Sub
Change:

VBA Code:
Range("Notes!L3").Value = AddressStreet = AddressStreet > Sheets("notes").range("l3").value = AddressStreet

Regards,
GB
 
Upvote 0
GB! Thanks for your input, that worked for getting the data into L3, is there a way to get it into the next empty cell instead? so I could add the next location in M3?
 
Upvote 0
This is what I was trying:
VBA Code:
Sub Location_Click()

    Dim AddressStreet As Variant
    Dim CityStateZip As Variant
    Dim c As Long

    c = Worksheets("Notes").Range(Column.Count, "3").End(xlRight).Offset(0, 1).Column
    AddressStreet = InputBox("Enter Business Address:")
    
    Sheets("Notes").Range(c, "3").Value = AddressStreet
    'CityStateZip = InputBox("Enter City, State, Zip:")
    'Sheets("Notes").Range("l4").Value = CityStateZip
    
End Sub
 
Upvote 0
Try.
VBA Code:
Sub Location_Click()
    Dim A&
    For A = Range("L3").Column To Range("T3").Column
    Sheets("Notes").Cells(3, A) = InputBox("Enter Business Address (Street):", "STREET")
    Sheets("Notes").Cells(4, A) = InputBox("Enter Business Address (City,State,Zip):", "ADDRESS")
    If Sheets("Notes").Cells(4, A) = "" Then Exit Sub
    Next A
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,734
Members
453,369
Latest member
juliewar

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