Hi,
I know this is probably basic programming for some of you: -) but after spending all afternoon watching youtube videos and getting
the same error message 'For without next' and 'Cannot execute code without break' I finally give up. ;-(
I have no training or knowledge of excel apart from as a user.
PLEASE HELP!!!
ok....ill keep it simple
on sheet1 I have a search box to enter 'store number; (and a button to link to the macro).
if a match is found on sheet2 column A (sheet 2 has 5 columns) results should be displayed back on sheet1 D6,E6,F6,G6,H6
there is more than one entry for the same store on sheet 2 they all need to be displayed on sheet 1 and its not in order.
this what I've tried so far.....copying a youtube video but it was design to only return one row I need all matches to be returned....
and it didn't work anyway.
Sub searchdata()
Dim erow As Long
Dim ws As Worksheet
Dim lastrow As Long
Dim count As Integer
lastrow = Sheets("Data2").cell(Rows.count, 1).End(x1up).Row
For X = 2 To lastrow
If Sheets("Data2").cellss(X, 1) = Sheet1.Range("b4") Then
Sheet1.Range("E6") = Sheets("data2").Cells(X, 1)
Sheet1.Range("F6") = Sheets("data2").Cells(X, 2)
Sheet1.Range("G6") = Sheets("data2").Cells(X, 3)
Sheet1.Range("H6") = Sheets("data2").Cells(X, 4)
Sheet1.Range("I6") = Sheets("data2").Cells(X, 5)
End If
End Sub
PS. This spread sheet is for a bank and I can't upload any of the information or onto here :-(
Bookmarks