ALLOCATE A FORMULA INTO A VARIABLE IN VBA

gab

New Member
Joined
Jul 24, 2007
Messages
24
HI!,,,I got an issue....till now, I allocate result of formula FORMULA R1C1 into the active cells,,,AND NOW I wan to allocate it into a variable x or y (I dont want that the result appears in the spreadsheet, just into a variable to work the code!)

ANY HELP IS WELCOME!
 
hi quiet riot...thanks for your answer, but unfortunately the formula you gave me is not working....i even modified to: a = Application.Cells("row", Index("K:K", Match(""LATE INTEREST & BK FEES :"", "K:K", 0))) ...(with 1 more " between the string,,,but is not working)...thanks again and please, i'll appreciatte more help
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
thanks antony, but the formula you gave no return the row number. dp i have to enter another command refering row in the line you gave me??

thanks!!!!!!
 
Upvote 0
thanks antony, but the formula you gave no return the row number
What does it return? Either read the variable or add the following instruction after VARIABLE1=Application.etc etc
Code:
Msgbox(VARIABLE1)

This will display the value of the variable.

Bye.
 
Upvote 0
hi anthony,

the formula "variable1" returns an error. I recognize the first formula is complicated, but a formula just with "match" is not returning the row number. Do i have to insert an additional formula (i.e row) in the variable1 etc etc???

thanks
 
Upvote 0
THANKS SO MUCH FPR THE FORMULA ANTHONY!....it wasnt work at the beginning because in vba the workshhetfuntion need to especified the cells as Range ( ).....and in this way:

a = Application.WorksheetFunction.Match("LATE INTEREST & BK FEES :", Range("K:K"), 0)

IT WORKS!...THANKS!!!!!!!!
 
Upvote 0
I dont understand.
Try this new version:

Variable1 = Application.WorksheetFunction.Match("LATE INTEREST & BK FEES :", Range("k:k"), 0)

BUT PLEASE replace K:K with the address of the column to be looked in.

Also note that if the string is not found, an error will be genarated that have to be managed. Are you sure that the string "LATE INTEREST & BK FEES :" exists axactely in your database? (no added space, for example).

Bye.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,272
Members
449,219
Latest member
daynle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top