LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default get name of sheets

Sub AddSheet()
Dim i As Long
Dim LastRow as Long

i = Worksheets.Count
Application.ScreenUpdating = False

Sheets(i).Copy Befo=Sheets(i)
ActiveSheet.Name = Range("h6").Value
LastRow = Cells(Rows.Count, "I").End(xlUp).Row
Range("H8:I" & LastRow).Clear
Range("H6").ClearContents
WorkSheets(1).Activate

FillBalanceSheets

Application.ScreenUpdating = True
End Sub

However, I am not
able to type text in the cell and then press the button.

You are still in cell edit mode. Code cannot run until you have completed
the cell data entry by pressing Enter or clicking another cell. You really
don't want to invoke a macro on this sheet by pressing Enter. The code would
be in a WorkSheet change Event, and would run every time you changed cells
anywhere on the sheet. A big drain on memory and performance. Stick with the
button.

wrote in message
ups.com...
Perfect!

How can I remove the contents of the H6 cell but not the formating?

I currently have a button assigned to call addsheet. However, I am not
able to type text in the cell and then press the button. I first have
to choose something outside of the cell. How can I make it so I type
in the cell and press enter which will invoke the macro?

Thanks.





 
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
How to update data from multiple sheets to one specific sheets Khawajaanwar Excel Discussion (Misc queries) 4 January 15th 10 07:31 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
In 3 active sheets in wkbk, determine& display the # of sheets that have data wrpalmer Excel Discussion (Misc queries) 1 November 4th 05 02:01 PM
Allocate Files to Sheets and Build a Master Sheet which Summarises All Sheets hanuman Excel Programming 0 September 9th 03 11:23 AM


All times are GMT +1. The time now is 06:54 AM.

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

About Us

"It's about Microsoft Excel"