Above is a sample of data, from a spread sheet where im working with a macro i found on the formus here,
Code:
'============================================
'- FIND RECORDS IN A DATA TABLE
'- AND PUT INTO A SUMMARY SHEET
'- needs a sheet called "Summary"
'- change "DataSheet" to lookup sheet name
'- Brian Baulsom February 2005
'=============================================
'-
Sub FindRecords()
Dim FromSheet As Worksheet
Dim FromRow As Long
Dim ToSheet As Worksheet
Dim ToRow As Long
Dim FindThis As Variant
Dim FoundCell As Object
'---------------------------------------------------
Application.Calculation = xlCalculationManual
Set FromSheet = ThisWorkbook.Worksheets("DataSheet")
Set ToSheet = ThisWorkbook.Worksheets("Summary")
ToRow = 2
'---------------------------------------------------
'- get user input
FindThis = InputBox("Please enter data to find : ")
If FindThis = "" Then End ' trap Cancel
'---------------------------------------------------
'- clear summary for new data
ToSheet.Cells.ClearContents
'---------------------------------------------------
' FIND DATA
'-
With FromSheet.Cells
Set FoundCell = .Find(FindThis, LookIn:=xlValues)
If Not FoundCell Is Nothing Then
FirstAddress = FoundCell.Address
'------------------------------------------
'- copy data to summary
Do
FromRow = FoundCell.Row
ToSheet.Cells(ToRow, 1).Value = _
FromSheet.Cells(FromRow, 1).Value
ToSheet.Cells(ToRow, 2).Value = _
FromSheet.Cells(FromRow, 2).Value
ToSheet.Cells(ToRow, 3).Value = _
FromSheet.Cells(FromRow, 3).Value
ToRow = ToRow + 1
Set FoundCell = .FindNext(FoundCell)
Loop While Not FoundCell Is Nothing And _
FoundCell.Address<> FirstAddress
'------------------------------------------
End If
End With
MsgBox ("Done.")
Application.Calculation = xlCalculationAutomatic
End Sub
this code is a little beyond what i know how to do so before i started chopping and changing the code i thought i would check here for advice on how i do it.
is what i need is for when the person enters in one of the store names from the list above, for it to display data stored in columns B, D and P. The columns it will need to search in for the specific store name are Q through to X (as shown in the spread sheet above) however
the data is store as follows (cell references below are Column:Row)
(Q:A1)Belconnen, #fyshwick
(W:A1)Boxhill, #Nunawading, #Coburg
hope i explained that clear enough for you guys to help
Regards
- Troy