LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default use a variable in a formula

I am writing code to add a vlookup function to a column of cells. Each time
the macro is run (because data is added to the spreadsheet), the lookup table
changes in size. The columns and start row don't change, but the end row may
increase. I have a variable LastRow that holds the row number of the end of
the table. How do I incorporate that into my code? Usinge the recorder, I'm
starting with this - I want to change "Sheet4!R2C1:R113C4" to something like
"Sheet4!R2C1:R'LastRow'C4"

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],Sheet4!R2C1:R113C4,4,0)"
 
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
DDE formula with variable Bruce Excel Worksheet Functions 0 November 16th 07 09:03 AM
variable in a formula libby Excel Programming 3 August 15th 04 04:31 AM
Variable in a Formula Amy Ja Excel Programming 3 April 21st 04 01:22 AM
Variable in a formula GM[_2_] Excel Programming 6 March 3rd 04 06:27 PM
Variable to formula. russell \(skmr3\) Excel Programming 1 July 30th 03 07:11 AM


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

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

About Us

"It's about Microsoft Excel"