Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Two parts of the same thing

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Two parts of the same thing

Hi Dave

To use a worksheet function in vba use this syntax:

Application.WorksheetFunction.Vlookup(....

To copy the value of a cell to several worksheets you can do this.

ValueToCopy=Workdsheets("Sheet1").Range("A1").valu e

Worksheets("Sheet2").range("A1")=ValueToCopy

Hopes it helps

Regards,
Per


"Risky Dave" skrev i meddelelsen
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Two parts of the same thing

Hi.

Q1
lookupval = Range("C1")
lookuparray = Range("A1:B10")
myvalue = Application.WorksheetFunction.VLookup(lookupval, lookuparray, 2,
False)


Q2
It can be done with changin sheets

Sheets("sheet2").Range("A1").Value = Sheets("Sheet1").Range("A1").Value
Sheets("sheet2").Range("B1").Value = Sheets("Sheet1").Range("A1").Value

Mike

"Risky Dave" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Two parts of the same thing

Don,

Thanks for your reply - please see my follow-up posting 4 minutes after I
realised I had posted to the wrong group and 30 minutes before your reply.

Dave

"Don Guillett" wrote:


Please post in ONE group ONLY. See your other post in .excel
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Risky Dave" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
not sure if i'm using the right thing Tiffany Excel Worksheet Functions 4 September 19th 08 05:21 PM
Need one more thing jln via OfficeKB.com Excel Programming 7 September 13th 06 03:46 PM
One Last Thing Coltsfan Excel Discussion (Misc queries) 1 January 16th 06 08:42 PM
Is there such a thing... Tom Excel Discussion (Misc queries) 1 April 19th 05 01:38 AM
one more thing Bompi Excel Worksheet Functions 1 January 11th 05 08:09 PM


All times are GMT +1. The time now is 05:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"