Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to use VBA write formula

Hello Guys,
I want to set a range value to a formula which reference
to another closed workbook range. but, I don't know how?

example:
rng.formulaR1C1="=vlookup("+search+",rng in [another
closed workbook]sheetname!"+"r9c9, 9)"

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How to use VBA write formula

Steve,

Along the lines of:

ActiveCell.FormulaR1C1 = _
"=VLOOKUP(" & Search & ",'C:\FolderName\" & _
"[WorkbookName.xls]SheetName'!R1C1:R9C9,9,FALSE)"

The R1C1:R9C9 means A1:I9...

The easiest way to get the syntax correct is to open both workbooks, make up
your formula so that it works, then close the workbook without the formula.
Then start the macro recorder, select the cell with the formula, press F2,
then press Enter. Turn off the recorder, and take a look at your code.

HTH,
Bernie
MS Excel MVP

" wrote in
message ...
Hello Guys,
I want to set a range value to a formula which reference
to another closed workbook range. but, I don't know how?

example:
rng.formulaR1C1="=vlookup("+search+",rng in [another
closed workbook]sheetname!"+"r9c9, 9)"

thanks



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
Write a Formula Esperanza Excel Worksheet Functions 2 February 13th 10 10:11 PM
Is there a better way to write formula Donna Excel Discussion (Misc queries) 5 November 30th 09 07:58 PM
Write formula to look for 'like' value Suzanne Excel Discussion (Misc queries) 2 May 21st 07 03:38 PM
How do I write this formula billy boy Excel Discussion (Misc queries) 3 March 29th 07 07:38 PM
how do i write a formula and keep in in formula form, so it DOESN. norcalchick2207 Excel Discussion (Misc queries) 2 February 4th 05 08:38 PM


All times are GMT +1. The time now is 08:34 PM.

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"