I was wondering how - if possible - I can go about using the autofill method to fill to the end of the column if the column isn't necessarily specified, but referenced. It's harder to explain than it is to see so here's what I'm working with right now. I just started using VBA a couple of months ago and I'm self taught, so please feel free to correct any common mistakes or unnecessary bits of code.
I've used this method of autofilling in several of my other macros but in all of them it's a static range. I need to be able to search the first row for a string, and work off of that column's location.
I also toyed with the idea of using a count of the rows as the autofill destination but I'm still unsure of how to write that into the autofill method.
Code:
'find start column and insert 1 column after
Set findcol = Worksheets(2).Rows(1).Find(What:="Tribeca", LookIn:=xlValues)
Dim FindColNum As Long
FindColNum = findcol.Column + 1
Columns(FindColNum).Insert shift:=xlToRight
'identify which IDs already exist and bring in correlating system ID
Columns(FindColNum).Cells(1, 1).Value = "SF ID"
Columns(FindColNum).Cells(2, 1).Formula = "=vlookup(a2,sfv,11,0)"
Columns(FindColNum).Cells(2, 1).AutoFill Destination:=Range("need help with this part" & Range("a" & Rows.Count).End(xlUp).Row)
I've used this method of autofilling in several of my other macros but in all of them it's a static range. I need to be able to search the first row for a string, and work off of that column's location.
I also toyed with the idea of using a count of the rows as the autofill destination but I'm still unsure of how to write that into the autofill method.