Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

I have a few sheets selected. How to have a new sheet be inserted at the
beginning, or deleting the first sheet, with the currently selected sheets
remaining to be selected.

A proper code for the same shall be obliged.

Thanx in advance.
--
Best Regards,

Faraz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

Dim sh As Worksheet

Set sh = ActiveSheet
Worksheets.Add befo=Worksheets(1)
sh.Activate


--
__________________________________
HTH

Bob

"Faraz A. Qureshi" wrote in
message ...
I have a few sheets selected. How to have a new sheet be inserted at the
beginning, or deleting the first sheet, with the currently selected sheets
remaining to be selected.

A proper code for the same shall be obliged.

Thanx in advance.
--
Best Regards,

Faraz



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

Thanx Bob!

However, this code I believe shall work only with a single sheet selected.
But what I have is a question pertaining to multiple sheets selected?

--
Best Regards,

Faraz


"Bob Phillips" wrote:

Dim sh As Worksheet

Set sh = ActiveSheet
Worksheets.Add befo=Worksheets(1)
sh.Activate


--
__________________________________
HTH

Bob

"Faraz A. Qureshi" wrote in
message ...
I have a few sheets selected. How to have a new sheet be inserted at the
beginning, or deleting the first sheet, with the currently selected sheets
remaining to be selected.

A proper code for the same shall be obliged.

Thanx in advance.
--
Best Regards,

Faraz




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

Hi,
Try this :
'------------------------------
Sub test()
Dim Sh As Object, X As String
With Workbooks(ThisWorkbook.Name)
.Activate
Set Sh = ActiveWindow.SelectedSheets
X = .ActiveSheet.Name
.Worksheets.Add befo=Sheets(1)
Sh.Select
.Sheets(X).Activate
End With
End Sub
'------------------------------

"Faraz A. Qureshi" a écrit dans le message de
groupe de discussion : ...
I have a few sheets selected. How to have a new sheet be inserted at the
beginning, or deleting the first sheet, with the currently selected sheets
remaining to be selected.

A proper code for the same shall be obliged.

Thanx in advance.
--
Best Regards,

Faraz

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

Run-time Error '91':
Object variable or With block variable not set
The following line being highlighted:

X = .ActiveSheet.Name

--
Best Regards,

Faraz


"MichDenis" wrote:

Hi,
Try this :
'------------------------------
Sub test()
Dim Sh As Object, X As String
With Workbooks(ThisWorkbook.Name)
.Activate
Set Sh = ActiveWindow.SelectedSheets
X = .ActiveSheet.Name
.Worksheets.Add befo=Sheets(1)
Sh.Select
.Sheets(X).Activate
End With
End Sub
'------------------------------

"Faraz A. Qureshi" a écrit dans le message de
groupe de discussion : ...
I have a few sheets selected. How to have a new sheet be inserted at the
beginning, or deleting the first sheet, with the currently selected sheets
remaining to be selected.

A proper code for the same shall be obliged.

Thanx in advance.
--
Best Regards,

Faraz




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.

Here's my go.
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
ADDING/DELETING SHEET Without losing focus? Faraz A. Qureshi Excel Discussion (Misc queries) 1 July 29th 09 12:55 PM
Workbook losing focus Anthony[_6_] Excel Programming 0 January 29th 09 06:04 PM
Excel losing focus and non-updating userforms mo_in_france[_2_] Excel Programming 1 May 21st 07 04:00 PM
Excel losing focus, but remains active ! Nandan Excel Programming 1 April 27th 07 02:32 PM
Adding And Deleting Sheets Anice Excel Programming 1 June 26th 06 03:51 PM


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