Hi I am looking to create a dynamic vlookup using a macro.
I need a vlookup formula that looks up the taxcode in column A of the sheet labelled Manual Adjustment
from the Tax Code of the sheet labelled Data.
In the Data tab the number of rows can be both more or less than shown in the attached.
For the Output tax it will always start on row 3 but if this dataset increases then the input tax may start at row 10 (as per the attached) but may also start in say row 15.
I used the following code to find the Input Tax to determine the start point. But I need a way of passing the variable startCell to my Vlookup.
I tried using End (xlDown) but to no avail
>>> use code - tags <<<
Any help would be very much appreciated
Thanks
Attachments
I need a vlookup formula that looks up the taxcode in column A of the sheet labelled Manual Adjustment
from the Tax Code of the sheet labelled Data.
In the Data tab the number of rows can be both more or less than shown in the attached.
For the Output tax it will always start on row 3 but if this dataset increases then the input tax may start at row 10 (as per the attached) but may also start in say row 15.
I used the following code to find the Input Tax to determine the start point. But I need a way of passing the variable startCell to my Vlookup.
I tried using End (xlDown) but to no avail
>>> use code - tags <<<
Code:
Private Sub fd()
Dim ws As Worksheet, findText As Range, startCell As String
Set ws = Sheets("Data")
ws.Select
Set findText = Cells.Find(What:="Input Tax:*")
startCell = findText.Offset(2, 2).Address
'MsgBox (startCell)
End Sub
Any help would be very much appreciated
Thanks
Attachments
Attachments
Last edited by a moderator: