ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   naming my worksheet (https://www.excelbanter.com/excel-programming/403233-naming-my-worksheet.html)

Charlie

naming my worksheet
 
I have a tabstrip on my userform to set the current sheet:
Private Sub TabStrip1_Change()
wsMyWorksheet = Worksheets("Sheet" & Me.TabStrip1.Value +1)
....but this doesn't work because it's combining a string with a number, I
think. How would I asign wsMyWorksheet to "sheetx" where x is the value of
tabstrip plus 1?


carlo

naming my worksheet
 
The combination of a number with a string shouldn't be a problem.

I think what you forgot is the "set" statement:

Private Sub TabStrip1_Change()

dim wsMyWorksheet as worksheet
set wsMyWorksheet = Worksheets("Sheet" & Me.TabStrip1.Value +1)

end sub

hth

Carlo

On Dec 26, 2:00*pm, Charlie wrote:
I have a tabstrip on my userform to set the current sheet:
Private Sub TabStrip1_Change()
wsMyWorksheet = Worksheets("Sheet" & Me.TabStrip1.Value +1)
...but this doesn't work because it's combining a string with a number, I
think. *How would I asign wsMyWorksheet to "sheetx" *where x is the value of
tabstrip plus 1?




All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com