Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does Sheet exist? If True Use If False Create


When my macro prints addresses from my form i create a sheet called
'print'. I then scale the sheet to A6 size - landscape - paste the data
i need into this sheet and then print the record.

What i need is the VBA code for Checking to see if this sheet exists
already. If it does then i would like to use it. If not i need to
create it.

i.e. If activesheet.("print")=true Then If False - not sure
Call insertData

End If
Set NewSheet = Worksheets.Add
NewSheet.Name = "Print"
Call InsertData

I know the code above in nonsense but it should help the Macro guru's
come up with the cunning solution to my problem, hopefully.


--
Shake
------------------------------------------------------------------------
Shake's Profile: http://www.excelforum.com/member.php...o&userid=28577
View this thread: http://www.excelforum.com/showthread...hreadid=483011

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Does Sheet exist? If True Use If False Create

try:

Sub addsht()
Dim prnt As Worksheet
On Error Resume Next
Set prnt = Sheets("Print")
On Error GoTo 0
If Not prnt Is Nothing Then
'do whatever with prnt eg prnt.activate
Else
Set prnt = Sheets.Add
prnt.Name = "Print"
'do the rest
End If
End Sub

Hope this helps
Rowan

Shake wrote:
When my macro prints addresses from my form i create a sheet called
'print'. I then scale the sheet to A6 size - landscape - paste the data
i need into this sheet and then print the record.

What i need is the VBA code for Checking to see if this sheet exists
already. If it does then i would like to use it. If not i need to
create it.

i.e. If activesheet.("print")=true Then If False - not sure
Call insertData

End If
Set NewSheet = Worksheets.Add
NewSheet.Name = "Print"
Call InsertData

I know the code above in nonsense but it should help the Macro guru's
come up with the cunning solution to my problem, hopefully.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does Sheet exist? If True Use If False Create


Rowan Drummond you are indeed an Excel Guru.

Thank You


--
Shake
------------------------------------------------------------------------
Shake's Profile: http://www.excelforum.com/member.php...o&userid=28577
View this thread: http://www.excelforum.com/showthread...hreadid=483011

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
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
I need to create a simple checkbox that has true false outputs RCN Excel Discussion (Misc queries) 1 June 6th 06 08:28 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
True Or False, no matter what... it still displays the false statement rocky640[_2_] Excel Programming 2 May 13th 04 04:57 PM


All times are GMT +1. The time now is 02:10 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"