ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a new worksheet (excel 2003) if one or more cells in a range is not empty (https://www.excelbanter.com/excel-programming/436455-create-new-worksheet-excel-2003-if-one-more-cells-range-not-empty.html)

Luc Ferrari

Create a new worksheet (excel 2003) if one or more cells in a range is not empty
 
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


jason

Create a new worksheet (excel 2003) if one or more cells in arange is not empty
 
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.

OssieMac

Create a new worksheet (excel 2003) if one or more cells in a rang
 
Hi Luc,

"if one or more cells in a range contain a value." What is this range and
what worksheet is it on? or is it simply a user selected range?

--
Regards,

OssieMac


"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

.


Luc Ferrari

Create a new worksheet (excel 2003) if one or more cells in a rang
 
Hi Luc,

"if one or more cells in a range contain a value." What is this range and
what worksheet is it on? or is it simply a user selected range?

--
Regards,

OssieMac


The range is part of a row , example : B5:V5
The range is always on the same sheet


Regards,
Luc

Luc Ferrari

Create a new worksheet (excel 2003) if one or more cells in a range is not empty
 
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


Thanks for the reply !
Does this create a worksheet for every cell in the range that contains a
value ? (example : 5 cells have a value = 5 sheets added)
I would achieve the following : Example : if 8 cells in the range contain a
value, then only 1 sheet should be added (never more than 1 sheet should be
added)

Thanxxxx

Luc


Luc[_7_]

Create a new worksheet (excel 2003) if one or more cells in a
 
Thanks for your help :=)


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

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