|
-
Aug 5th, 2012, 02:38 PM
#1
Thread Starter
Lively Member
[RESOLVED] How to use a SpinButton to scroll through spreadsheets?
Hi,
I did a code to find sheets with some word in its name (word typed in a textbox; "InStr" to compare, etc). So, I saved numbers of these sheets in a vector (Dim sheets_with_my_word() as Integer).
Now I need to export this vector to a new userform that contains a SpinButton (and labels) to alternate among worksheets with that word in the name.
How could I do this?
-
Aug 5th, 2012, 04:39 PM
#2
Re: How to use a SpinButton to scroll through spreadsheets?
try
Code:
set sht = sheets(sheets_with_my_word(spinbutton1.value))
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 7th, 2012, 06:31 PM
#3
Thread Starter
Lively Member
Re: How to use a SpinButton to scroll through spreadsheets?
Thanks I tried and I agree that can be the solution, but
"sheets_with_my_word()" received values in a userform and the spinbutton is in another, is it possible to "export" a variable from one userform to another?
-
Aug 8th, 2012, 06:54 AM
#4
Re: How to use a SpinButton to scroll through spreadsheets?
declare a public variable at the top of a module, that way it will remain in scope even after the userform is unloaded
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 8th, 2012, 07:29 AM
#5
Thread Starter
Lively Member
Re: How to use a SpinButton to scroll through spreadsheets?
Perfect. I declared in a module but I had forgotten to use "public".
Thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|