Macro to search and display

robert220

New Member
Joined
Jul 25, 2008
Messages
9
I'm trying to create a search for it will search the sheet and display information in separate area.
This is what i have but it's not pulling any info.
ub Searchdata()
Dim Lastrow As Long
Dim count As Integer

Lastrow = Sheets("Raw Data").Cells(Rows.count, 2).End(xlUp).Row
For X = 2 To Lastrow
If Sheets("Raw Data").Cells(X, 1) = Sheet1.Range("K1") Then
Sheet1.Range("M1") = Sheets("Raw Data").Cells(X, 1)
Sheet1.Range("N1") = Sheets("Raw Data").Cells(X, 2)
Sheet1.Range("O1") = Sheets("Raw Data").Cells(X, 3) & " " & Sheets("Raw Data").Cells(X, 4)
Sheet1.Range("P1") = Sheets("Raw Data").Cells(X, 5)
Sheet1.Range("Q1") = Sheets("Raw Data").Cells(X, 6)
Sheet1.Range("R1") = Sheets("Raw Data").Cells(X, 7) & " " & Sheets("Raw Data").Cells(X, 8)
End If
Next X
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I figure out what i was doing wrong. but still have one issue When searching the cell it has to match exactly If i try to use lower case letters it will not find anything because everything that it's searching is in Capitol letters, anyway to fix that?
 
Upvote 0
How about
Code:
If LCase(Sheets("Raw Data").Cells(x, 1)) = LCase(Sheet1.Range("K1")) Then
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top