Return Variable Value

motabrasil

New Member
Joined
May 11, 2010
Messages
28
People

I have a macro with several Userforms. And, from one of them, I calculated some values and save the result into the variable "Z", as described below:

Z = Z + (Cells(Rw, colPQuantity) * Cells(Rw, colRUnitPrice))

Now, I need to capture that "Z" value using another Userform and Paste into a specific cell like:

Set ws = Worksheets("Total")
ws.Cells(4, "L").Value = Z.Value


How to do that?

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Declare the variable Z as global, example

Code:
Global Z As Long

this should ideally be in a standard module.
 
Upvote 0
Why do you need to 'capture' the value with another userform before you put it on the worksheet?

What exactly is Z? You say it's a variable but variables don't have properties like .Value.:)
 
Upvote 0
Basically, because I have in that Template several Userforms. In one of them I calculate "Z" for a specific purpose. After that, if the user need, he can use the same "Z" value for another purpose. So he just need to select the new userfom and capture the "Z" value for this.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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