Help with vlookup cell VBA

Excelnoobisme

Board Regular
Joined
Nov 19, 2010
Messages
128
Hi,

I have a worksheet name A, on cell A1 is the date.

If i open another worksheet name B, there are pre-defined date on Column A(i.e. Mar 1 to 30) where in between each date there are 10 empty row.
Hence Mar 1 on cell A1, Mar 2 on cell A11 and Mar 3 on cell A21........

How can i write a marco that if i run on worksheet A, it will see the date on cell A1 and lookup to Sheet B and select 2 rows below after the same date.
(example date on cell A1 in worksheet A is Mar 3, so it will select cell A23 on worksheet B)

any help will be greatly appreciated.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try

Code:
Sub test()
Dim Found As Range
Set Found = Workbooks("B.xls").Sheets("Sheet2").Columns("A").Find(what:=Workbooks("A.xls").Sheets("Sheet1").Range("A1").Value, LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then
    MsgBox "Not found"
Else
    Workbooks("A.xls").Sheets("Sheet1").Range("C2:C5").Copy
    Workbooks("B.xls").Sheets("Sheet2").Range(Found.Address).Offset(2).PasteSpecial Paste:=xlPasteValues
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top