I can't seem to figure out the issue here, I keep getting the Range_Global_failed error. Trying to make this cut/paste code as short as possible:
Any suggestions?![]()
Please Login or Register to view this content.
I can't seem to figure out the issue here, I keep getting the Range_Global_failed error. Trying to make this cut/paste code as short as possible:
Any suggestions?![]()
Please Login or Register to view this content.
Remove:
![]()
Please Login or Register to view this content.
Please consider adding a * if I helped
That segment of code is the Paste destination. What is the proper way of writing this?
Paste
is missing from the code.
Okay, thank you. My variable (count1) is in a different subroutine. How do I declare it in such a way that it's value can be used in this line of code? (public variable?)
Something like this :
![]()
Please Login or Register to view this content.
Thanks, wfm007. I found an additional problem to be that my variable count1 (from the previous subroutine) is empty. It should be a positive integer, but once that previous sub ends the value is not retained. How might I allow this subsequent subroutine to access that value?
If you trying to access a variable from another sub, you need to declare that variable as global
This might help you
In VBA there are three levels of scope.
Local: the variable is declared inside a Sub or Function, using the Dim or Static keyword and is only availible inside that procedure.
Code:
...![]()
Please Login or Register to view this content.
Module-wide: the variable is declared at the beginning of the module with the Dim keyword. it is available ot all procedures in that module, but not to procedures in other modules
Code:
...![]()
Please Login or Register to view this content.
Public - the variable is declared at the beginning of a normal module with the Public key word. It is avaliable to all procedures is all modules of that project. (Variables declared with Public in Class, Userform and Object code modules have specialized meanings.)
Code:
...![]()
Please Login or Register to view this content.
Global is not a VBA reserved word. There are no (uppercase) Global variables in VBA. "global" is a term in the meta-language of programming, not in the programming language VBA
Wow, exactly what I needed. Thanks a ton AB33
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks