Two parts of the same thing

R

Risky Dave

Hi,

Within a piece of VBA under Office 2007 on Vista:

1) What is the syntax to use the VlookUp function from within VBA (I want to
run a macro that looks does a VlookUp and returns the value to the code - I
do not want to embed formulae within the spreadsheet)?
2) I want to copy the contents of a cell on one page to cells on two other
pages. Is it possible to do this with one command or do I have to copy-change
page-paste-change back-copy-change to 2nd page-paste- change back?

TIA

Dave
 
D

Don Guillett

This is looking in col B for .2 and getting 2 cells to the right to copy to
2 sheets.

Sub insteadoflookup()
Set myc = Columns("B").Find(What:="0.2", After:=Cells(1, "b"), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False).Offset(0, 2)

myc.Copy Sheets("sheet8").Range("d1")
myc.Copy Sheets("sheet7").Range("f1")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top