I have vba code that gets a value for Lrow such as 300. I want to pass this value to the spreadsheet
so it can be used such as a variable in a formula
such as a formula in cell d23 =Lrow+45
Thanks carroll
I have vba code that gets a value for Lrow such as 300. I want to pass this value to the spreadsheet
so it can be used such as a variable in a formula
such as a formula in cell d23 =Lrow+45
Thanks carroll
There are 29 ways to do this, depending on what you are trying to achieve. Here's one:
Please Login or Register to view this content.
A B C 1 2 43 3 37 59B3: =lRow + 45 4 3 5 97 6 12 7 96 8 92 9 67 10 48 11 26 12 100 13 94 14 8 15 16
Entia non sunt multiplicanda sine necessitate
Thanks SHG You gave a good example. I can now use ActiveSheet.Range("Q2").Value = lRow to
to put lrow in cell q2 in the spreadsheet.
My challenge now is to use this lrow value in a formula that uses a range, like
,=IFERROR(LOOKUP(1,-SEARCH($IG$6:$IG$2190,$IJ7),$II$6:$II$2190)," ")
where I need to replace 2190 with a reference to a cell containing the lrow value
for example if I use ActiveSheet.Range("IG2").Value = lRow then the formula above
might look like
,=IFERROR(LOOKUP(1,-SEARCH($IG$6:$IG$&(ig2),$IJ7),$II$6:$II$&(ig2))," ")
However this does not work and I have been unsuccessful in replacing the 2190
with a reference to the lrow value in IG2 which changes with different sets of data.
Thanks for your help Carroll
Not tested but can you use Indirect i.e.
Formula:Please Login or Register to view this content.
If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved
Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown
Change references where required
Please Login or Register to view this content.
Worked great thanks much
Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
Thanks.
Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks