Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Create a new worksheet (excel 2003) if one or more cells in arange is not empty

On Nov 20, 2:59*pm, jason wrote:
On Nov 20, 2:17*pm, "Luc Ferrari" wrote:

I want to create a new "tab, worksheet or whatever you call it " (in excel
2003) if one or more cells in a range contain a value.
The code starts after i hit a "button".


And name the sheet after the value of the cell left of the first cell of
that range.


I have no clue in how to program this.
Can someone provide me the code for this....


Thanks for your help


Luc


a finite range? ie: cells A1:A20 or an infinite range?

if finite:

sub A()
dim i
for i=1 to 20
*if thisworkbook.activeshees.cells(i,1)<"" then
* * *thisworkbook.sheets.add.name= * * thisworkbook.sheets.cells(i,
1).value 'or thisworkbook.sheets.cells(i,1).text
end if
next i

this should work.


EDIT:


sub A()
dim i
for i=1 to 20
if thisworkbook.activeshees.cells(i,1)<"" then
thisworkbook.sheets.add.name= thisworkbook.sheets.cells(i,
1).value 'or thisworkbook.sheets.cells(i,1).text
exit sub

end if
next i

the above code will add one worksheet per non-empty cell. this will
add only one for the first non-empty value found in cells A1:A20
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
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
Create a new worksheet (excel 2003) if one or more cells in a range is not empty Luc Ferrari Excel Programming 5 November 22nd 09 11:22 AM
Excel 2003 attachments open and show only empty cells when openedvia Outlook 2003? Rob Gordon Excel Discussion (Misc queries) 1 December 2nd 08 09:34 PM
Excel 2003 - Create Copy of Worksheet not working [email protected] Excel Discussion (Misc queries) 0 October 31st 08 07:15 PM
Create an identical Chart Worksheet in Excel 2003 Brooks Charts and Charting in Excel 1 December 7th 07 11:57 AM


All times are GMT +1. The time now is 02:11 PM.

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"