LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Open and format new worksheet without selecting it?

Hi everyone

Below is the start of a procedure to delete an existing worksheet and create
a new worksheet to replace old.
What changes to code is required to:-
If FOOD sheet not included in workbook the Set dt throws up and error, how
do you skip the FOOD delete op. and Add a new FOOD sheet anyway?
How do you code to open a new worksheet give it a tab name and 4 column
title header in A1 to D1 without actually selecting the new sheet?

Sub Test()

Dim dt As Worksheet
Set dt = Worksheets("FOOD")

ActiveWorkbook.Sheets("Where It Goes").Activate

Application.DisplayAlerts = False
Worksheets("FOOD").Delete
Application.DisplayAlerts = True
'
[C2].Value = [J1] enter start date in Where It Goes worksheet.
[G2].Value = [J2] enter finish Date in Where It Goes worksheet.
'
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "FOOD"
ActiveSheet.Tab.ColorIndex = 4
'
I find it very difficult not to use select and activate each sheet to
achieve the copying and pasting of values formula etc. from one sheet to next
sheet or workbook.

All help greatly appreciated.

--
Thank you

Regards

Bob C
Using Windows XP Home + Office 2003 Pro
 
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
Selecting the certain format Sir Excel Discussion (Misc queries) 4 December 7th 08 06:21 AM
Selecting needed format Sir Excel Discussion (Misc queries) 6 December 7th 08 06:21 AM
selecting several open worksheets Annette Excel Discussion (Misc queries) 8 September 2nd 08 11:03 PM
selecting multiple sheet tabs and open another workbook Bannor Excel Discussion (Misc queries) 5 November 25th 05 02:38 AM
Selecting the other open workbook Karen[_6_] Excel Programming 2 August 19th 03 05:48 PM


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