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
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Why do you want/need to put the data in a specific row?

Are you altering existing data or adding new data?
 

HDfatboy03

Board Regular
Joined
May 23, 2010
Messages
62
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
 

Forum statistics

Threads
1,081,904
Messages
5,361,996
Members
400,667
Latest member
cryptomike

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top