not very bright dave
Board Regular
- Joined
- Dec 20, 2004
- Messages
- 244
Hi guys
I'm looping through a number of rows and copying any cells that meet the criteria in a combobox and pasting on another worksheet. It works fine if I send the combobox value to a cell and get the code to look at that but when I try to get it to look at the value in the combobox, it messes up. I'm guessing it must be something to do with the loop re-accessing the combobox value each time around. Does anyone have any ideas?
Thanks
Dave
finalrow = Cells(65536, 1).End(xlUp).Row
For i = 1 To finalrow
Worksheets("sheet2").Activate
Cells(i, 1).Select
If Cells(i, 1).Value = Userform7.Combobox1.Value Then
Selection.Copy
Worksheets("sheet3").Activate
Cells(65536, 1).Select
Selection.End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
End If
Worksheets("sheet4").Activate
Next i
I'm looping through a number of rows and copying any cells that meet the criteria in a combobox and pasting on another worksheet. It works fine if I send the combobox value to a cell and get the code to look at that but when I try to get it to look at the value in the combobox, it messes up. I'm guessing it must be something to do with the loop re-accessing the combobox value each time around. Does anyone have any ideas?
Thanks
Dave
finalrow = Cells(65536, 1).End(xlUp).Row
For i = 1 To finalrow
Worksheets("sheet2").Activate
Cells(i, 1).Select
If Cells(i, 1).Value = Userform7.Combobox1.Value Then
Selection.Copy
Worksheets("sheet3").Activate
Cells(65536, 1).Select
Selection.End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
End If
Worksheets("sheet4").Activate
Next i