G
Guest
Hi,
I have a rather general question due to lack of any programming background.
There is a database of 70 columns and I have various macros working with it.
The below this piece of code i have to repeat in every one of them and I
feel it could be done ones and for all. What's the best way to do it?
******************
'setup
shName = Application.InputBox("Enter the name of the data sheet:")
Set dataSh = Worksheets(shName)
Set HEADINGS = ActiveSheet.Range("a1").Resize(1, Range("a1").End
_(xlToRight).Column)
With HEADINGS
Set QUOTE_ID = Cells.Find("QUOTE_ID", MatchCase:=False)
Set QUOTEDATE = Cells.Find("QUOTEDATE", MatchCase:=False)
Set Name_ID = Cells.Find("Name_ID", MatchCase:=False)
Set POLICY_ID = Cells.Find("POLICY_ID", MatchCase:=False)
Set PREVPOLICY = Cells.Find("PREVPOLICY", MatchCase:=False)
'..... Set up other columns as needed
End With
*************
Thanks ,
I have a rather general question due to lack of any programming background.
There is a database of 70 columns and I have various macros working with it.
The below this piece of code i have to repeat in every one of them and I
feel it could be done ones and for all. What's the best way to do it?
******************
'setup
shName = Application.InputBox("Enter the name of the data sheet:")
Set dataSh = Worksheets(shName)
Set HEADINGS = ActiveSheet.Range("a1").Resize(1, Range("a1").End
_(xlToRight).Column)
With HEADINGS
Set QUOTE_ID = Cells.Find("QUOTE_ID", MatchCase:=False)
Set QUOTEDATE = Cells.Find("QUOTEDATE", MatchCase:=False)
Set Name_ID = Cells.Find("Name_ID", MatchCase:=False)
Set POLICY_ID = Cells.Find("POLICY_ID", MatchCase:=False)
Set PREVPOLICY = Cells.Find("PREVPOLICY", MatchCase:=False)
'..... Set up other columns as needed
End With
*************
Thanks ,