Hello,
I've been searching all day to try to find an answer to my question.
Unfortuneately I haven't been able to find anything specific to my
issu. This may be because I am not using the right keywords, so
forgive me if this is a duplicate question of another posting.
Anyway, I have an excel spreadsheet of data that is sent to my group
each month. I am trying to automate the process of extracting the
data/columns that we need to import into access. 2 of the columns
contain fullnames. I need to split these columns into LastName and
FirstName which I have already done. However, in my code it the column
is chosen by the column range i.e (Q:Q). However, this is not always
true every month, so I wanted to be able to pick the column by the
column header instead. I am using the code below, but for some reason
it isn't moving across the column. It is moving down the rows. Can
someone please take a look at it and tell me what I am missing?
Thanks
SearchValue = "GOwner" ' Set search value"
Set rng =
Worksheets("Sheet2").Range("A1").SpecialCells(xlCellTypeLastCell)
'lLastRow = rng.Row
lLastCol = rng.End(xlToRight).Column
Dim cVal As String
For i = 1 To lLastCol
MsgBox "Column = " & i
If Cells(i, "A").Value = SearchValue Then
MsgBox "Search value found at Column: " & i
End If
Next i
Bookmarks