HELP with vba FORM user input dictate ouput to row in table

HDfatboy03

Board Regular
Joined
May 23, 2010
Messages
62
Hello ... needing some help with a variable, I want to be able to have data copied to a TABLE to a specific row based on user input "Textbox1". So if the user enters "2" then the below data is copied to row 2 and if they enter "110" then the data is copied to row 110.

<START CODE:>

Textbox1 = ?

'copy the data to the database
ws.Cells(?, "A").Value = Me.txtDate.Value
ws.Cells(?, "B").Value = Me.cboCategory.Value
ws.Cells(?, "C").Value = Me.txtBusn.Value
ws.Cells(?, "D").Value = Me.txtVndr.Value
ws.Cells(?, "E").Value = Me.txtAdd1.Value
ws.Cells(?, "F").Value = Me.txtAdd2.Value
ws.Cells(?, "G").Value = Me.txtCity.Value
ws.Cells(?, "H").Value = Me.txtState.Value
ws.Cells(?, "I").Value = Me.txtZip.Value

End Sub

<END CODE:>

Thanks in advance any help or suggestions will be greatly appreciated.

HDfatboy03
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Perhaps

Code:
Dim x As Long
x = CLng(Me.Textbox1.Text)

'copy the data to the database
ws.Cells(x, "A").Value = Me.txtDate.Value
 
Upvote 0
Why do you want/need to put the data in a specific row?

Are you altering existing data or adding new data?
 
Upvote 0
WOW ... You are AWESOME, on the first try. I appreciate your help so much. I do have another quick question. I am wanting for cell B,2 to change colors based on the input of A,2. I believe this is called conditional formatting. The criteria is as follows:

If A,2 = HOLD, THEN B,2 turns "YELLOW" or
If A,2 = TAKEN, THEN B,2 turns "GREEN" or
If A,2 = AVAILABLE, THEN B,2 turns "GREY"

END SUB

Thanks again for your help earlier and if you can shed some light with this it will be greatly appreciated.

HDfatboy03
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,861
Members
449,052
Latest member
Fuddy_Duddy

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