ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   search worksheet (https://www.excelbanter.com/excel-programming/364098-search-worksheet.html)

anderssweden

search worksheet
 
I am making an automated reporting system for a bank. I copy information from
another program and insert it into excel. The information is columns with
headllines. Since the order of the info is somewhat different each time I
want to write a macro that identifies the headlines and places the
information in proper order. (I am a beginner in VisualBasic). Very thankful
for fast relpy!
--
banker

Tom Ogilvy

search worksheet
 
Assume our headers are in Row 1 of whichever sheet you need to search. You
can find which column they are in with

Dim sHdr as String, sh as Worksheet, rng as Range
Set sh = Worksheets("SheettoSearch")
sHdr = "LastName"
set rng = sh.Range("A1:IV1").Find(sHdr)
if not rng is nothing then
msgbox "Found at " & rng.Address(0,0,xlA1,True)
Else
msgbox sHdr & " Not found"
end if

--
regards,
Tom Ogilvy



"anderssweden" wrote:

I am making an automated reporting system for a bank. I copy information from
another program and insert it into excel. The information is columns with
headllines. Since the order of the info is somewhat different each time I
want to write a macro that identifies the headlines and places the
information in proper order. (I am a beginner in VisualBasic). Very thankful
for fast relpy!
--
banker



All times are GMT +1. The time now is 08:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com