Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Putting woirksheet name into a variable

I have a form where a new sheet is created in a workbook. Everytime a sheet
is created it incraments up (sheet1, sheet2, sheet3, sheet4). I was tring to
put the active sheet name into a varable but I do not know the syntax.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Putting woirksheet name into a variable

try this:-

Sub filefile()
With ThisWorkbook
.Sheets.Add After:=.Sheets(.Sheets.Count)
End With
myName = ActiveSheet.Name
msgbox myName
End Sub

"BZeyger" wrote:

I have a form where a new sheet is created in a workbook. Everytime a sheet
is created it incraments up (sheet1, sheet2, sheet3, sheet4). I was tring to
put the active sheet name into a varable but I do not know the syntax.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Putting woirksheet name into a variable

On 17 Apr, 17:38, BZeyger wrote:
I have a form where a new sheet is created in a workbook. Everytime a sheet
is created it incraments up (sheet1, sheet2, sheet3, sheet4). I was tring to
put the active sheet name into a varable but I do not know the syntax.


Dim sWshName as string
sWshName=activeworkbook.worksheets(activeworkbook. worksheets.count).name

should do the job

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Putting woirksheet name into a variable

Option Explicit

Sub zeyger()

Dim ws As Worksheet
Dim sName As String

sName = "Zeyger"

Worksheets.Add
ActiveSheet.Name = sName

End Sub


hth!
susan

On Apr 17, 12:38 pm, BZeyger
wrote:
I have a form where a new sheet is created in a workbook. Everytime a sheet
is created it incraments up (sheet1, sheet2, sheet3, sheet4). I was tring to
put the active sheet name into a varable but I do not know the syntax.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
putting a name in the name box donr5 Excel Discussion (Misc queries) 2 May 8th 23 11:44 AM
Putting macros together saman110 via OfficeKB.com Excel Discussion (Misc queries) 6 July 24th 07 08:34 PM
Putting Matt[_40_] Excel Programming 0 January 19th 07 07:19 PM
Putting a search box Sylvia[_13_] Excel Programming 1 January 12th 06 03:35 PM
Putting text in a column based on variable text from another colum Jacky D. Excel Discussion (Misc queries) 1 December 16th 04 06:09 PM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"