![]() |
A few Question Concerning VBA in Excel
In the following the "Macro1" does not work while "Macro1_1" does. I
know I got a method to make Range("VarName") update while being a parameter in a subroutine. But could you explain to me why and if I have done it correctly. Option Explicit Sub SaveData(A1, A2, A3) A1 = 9 A2 = 8 A3 = 7 End Sub Sub macro1() Range("name1") = "'" Range("name2") = "" Range("name3") = "" Call SaveData(Range("name1"), Range("name2"), Range("name3")) End Sub '--- BOTTOM ONES WORK THE TOP ONES DON'T Sub SaveData_1(A1 As Range, A2 As Range, A3 As Range) A1 = 9 A2 = 8 A3 = 7 End Sub Sub macro1_1() Range("name1") = "'" Range("name2") = "" Range("name3") = "" Call SaveData_1(Range("name1"), Range("name2"), Range("name3")) End Sub [Second question I have a code example] Dim Zero As Range Sub Save_Unit_Qunatities(A1 As Range, A2 As Range, A3 As Range, A4 As Range, A5 As Range, A6 As Range, A7 As Range) Set Zero = Range("Zero") 'Zero is a reference variable that is 0 [Is there a way I could assign a range variable such a Zero like this Zero = 0 ] Call Save_Unit_Qunatities(Range("PressDocking1A_Suit_Do cking_Qty_V"), Range("PressDocking1A_Rover_Docking_Qty_V"), Range("PressDocking1A_Vehicle_Docking_Qty_V"), Zero, Zero, Zero, Zero) [I have to use Zero because the problem is I can't do the following: ] Call Save_Unit_Qunatities(Range("PressDocking1A_Suit_Do cking_Qty_V"), Range("PressDocking1A_Rover_Docking_Qty_V"), Range("PressDocking1A_Vehicle_Docking_Qty_V"), 0#, 0#, 0#, 0#) [And final question when I make this call] Call Save_Unit_Qunatities(Range("PressDocking1A_Suit_Do cking_Qty_V"), Range("PressDocking1A_Rover_Docking_Qty_V"), Range("PressDocking1A_Vehicle_Docking_Qty_V"), Zero, Zero, Zero, Zero) The reference cell "PressDocking1A_Suit_Docking_Qty_V" takes on numbers but there "numbers stored as text." I there a way I can save them as numbers? I would really appreciate any help in this matter, Thanks, |
All times are GMT +1. The time now is 07:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com