I currently have a set of columns I would like to format, based on the title of the column. To find out how to format the column I perform a Vlookup using the column title to find the matched format type
My vlookup sheet looks like this (and that part of the code is working to return the correct format value
My code is the following
Sub FormatCols()
Dim CurrCol As String
Dim NumCol As Integer
Sheets("CORE").Select
Range("A10").Select
NumCol = ActiveCell.Value
Range("C10").Select
For I = 1 To NumCol
Sheets("CORE").Select
ActiveCell.Offset(0, 1).Select
CurrCol = ActiveCell.Value
Sheets("Formats").Select
CurrFormat = WorksheetFunction.VLookup(CurrCol, Range("A:B"), 2, False)
Sheets("CORE").Select
EntireColumn.NumberFormat = CurrFormat
Next I
End Sub
It is bombing the first time through the loop at the end of the loop
EntireColumn.NumberFormat = CurrFormat
CurrCol="Ticker"
CurrFomat = ""_0""
I also tried making the CurrFormat in my Vlookup table to be just _0 so that the CurrFomat variable = "_0" (single rather than double quotes, and that did not work either
any help would be appreciated
And the main CORE sheet is
My vlookup sheet looks like this (and that part of the code is working to return the correct format value
My code is the following
Sub FormatCols()
Dim CurrCol As String
Dim NumCol As Integer
Sheets("CORE").Select
Range("A10").Select
NumCol = ActiveCell.Value
Range("C10").Select
For I = 1 To NumCol
Sheets("CORE").Select
ActiveCell.Offset(0, 1).Select
CurrCol = ActiveCell.Value
Sheets("Formats").Select
CurrFormat = WorksheetFunction.VLookup(CurrCol, Range("A:B"), 2, False)
Sheets("CORE").Select
EntireColumn.NumberFormat = CurrFormat
Next I
End Sub
It is bombing the first time through the loop at the end of the loop
EntireColumn.NumberFormat = CurrFormat
CurrCol="Ticker"
CurrFomat = ""_0""
I also tried making the CurrFormat in my Vlookup table to be just _0 so that the CurrFomat variable = "_0" (single rather than double quotes, and that did not work either
any help would be appreciated
And the main CORE sheet is