as an old grey head approaching 70, I have decided to learn VBA. I have been grateful to this forum particularly in that Journey. Please forgive any error in protocols or procedures.
I have a Workbook which has a BankRec Sheet which has cheque numbers in AA:DY with headings (Week1 etc) in Row 2 and cheque data starting from Row 3 to 30 with column in between each week (Heading REC).
My task is to find the cheque number in Week column and then post 'Yes' in the adjacent cell in the rec column.
The UserForm4 has ComboBox1 with a dropdown list with Week1, Week2 etc to Week52 (Headings in AA:DY range Row 2)
There is a second ComboBox2 with a drop down List of the cheque numbers.
The Final ComboBox3 has the dropdown with 'Yes' and 'No'.
Everything works until the search and find portion of the code. I have tried various options and get errors of Object not found or compile issues.
The current code is:
Private Sub CommandButton1_Click()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
TargetSheet = "BankRec"
Worksheets(TargetSheet).Activate
Range("AA3").Select
Do
Cells.Find(What:="ComboBox2.Value", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
ActiveSheet.Cells(ActiveCell + 1).Value = ComboBox3.Value
Loop
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
MsgBox ("Data has been added successfully")
ComboBox1.Value = ""
ComboBox2.Value = ""
ComboBox3.Value = ""
Worksheets("Master").Activate
Worksheets("Master").Cells(1, 1).Select
End Sub
God any of your good people help me as after a few hours I am unable to solve the issue.
Any help would be gratefully appreciated.
Subbie
I have a Workbook which has a BankRec Sheet which has cheque numbers in AA:DY with headings (Week1 etc) in Row 2 and cheque data starting from Row 3 to 30 with column in between each week (Heading REC).
My task is to find the cheque number in Week column and then post 'Yes' in the adjacent cell in the rec column.
The UserForm4 has ComboBox1 with a dropdown list with Week1, Week2 etc to Week52 (Headings in AA:DY range Row 2)
There is a second ComboBox2 with a drop down List of the cheque numbers.
The Final ComboBox3 has the dropdown with 'Yes' and 'No'.
Everything works until the search and find portion of the code. I have tried various options and get errors of Object not found or compile issues.
The current code is:
Private Sub CommandButton1_Click()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
TargetSheet = "BankRec"
Worksheets(TargetSheet).Activate
Range("AA3").Select
Do
Cells.Find(What:="ComboBox2.Value", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
ActiveSheet.Cells(ActiveCell + 1).Value = ComboBox3.Value
Loop
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
MsgBox ("Data has been added successfully")
ComboBox1.Value = ""
ComboBox2.Value = ""
ComboBox3.Value = ""
Worksheets("Master").Activate
Worksheets("Master").Cells(1, 1).Select
End Sub
God any of your good people help me as after a few hours I am unable to solve the issue.
Any help would be gratefully appreciated.
Subbie