lpking2005
Board Regular
- Joined
- Mar 21, 2011
- Messages
- 140
hi, i have a huge workbook containing alot of values.
within this work book is several rows acting as titles.
What i need is to be able to input data into a userform then when i click ok it puts all the info into the correct columns.
my problem at the moment is on the userform button click event,
i want it to find the correct header (based on the selected combobox item) and insert a new row above it and then input data from the userform textbox`s into the correct columns.
But i think ive done something wrong with the if statements!?
can someone tell me how i can ammend this please?
heres my code:
within this work book is several rows acting as titles.
What i need is to be able to input data into a userform then when i click ok it puts all the info into the correct columns.
my problem at the moment is on the userform button click event,
i want it to find the correct header (based on the selected combobox item) and insert a new row above it and then input data from the userform textbox`s into the correct columns.
But i think ive done something wrong with the if statements!?
can someone tell me how i can ammend this please?
heres my code:
Code:
Private Sub CommandButton1_Click()
Dim rngFound As Range
'input new data into engineering category
If ComboBox1.Value = "Engineering" Then
Set rngFound = Range("A:A").Find(What:="Manufacturing Bulks", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Manufacturing Bulks Category was not found"
Else
rngFound.EntireRow.Insert
End If
End If
End Sub