Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Change cell formula & assign to VBA variable...

Hello,

I need some help changing my code to assign a current cell's formula to a
VBA variable:

Cell formula:

=ADDRESS(MATCH(VALUE(RIGHT(I17,1)),'1st'!$C4:'1st' !$C13,0)+3,MATCH(VALUE(RIGHT(I16,1)),'1st'!$D3:'1s t'!$M3,0)+3,4)

VBA variable assignment:

Dim name1st As Range
Dim name2nd As Range
Dim sheet1st As Range
Dim sheet2nd As Range

Set name1st = Range("I17")
Set name2nd = Range("I16")
Set sheet1st = Worksheets("1st").Range("C4:C13")
Set sheet2nd = Worksheets("1st").Range("D3:M3")

'When I attempt to rewrite the following code, I am getting an 'Object
required' error on this line:

color1st = Address(Match(Value(Right(name1st, 1)), sheet1st, 0) + 3,
Match(Value(Right(name2nd, 1)), sheet2nd, 0) + 3, 4)

I appreciate any help in getting this written correctly.

Thanks much,

Kevin

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
XL how to change a cell reference in a formula to variable value? Bernard Excel Worksheet Functions 6 June 18th 07 09:22 AM
How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 9th 05 11:40 PM
Assign relative cell reference to variable Hardy[_7_] Excel Programming 0 September 7th 04 10:57 AM
Assign Formula to Variable James Stephens Excel Programming 3 February 26th 04 04:16 PM


All times are GMT +1. The time now is 09:46 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"