Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
ADDING/DELETING SHEETS WITHOUT LOSING FOCUS.
Here's my go.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ADDING/DELETING SHEET Without losing focus? | Excel Discussion (Misc queries) | |||
Workbook losing focus | Excel Programming | |||
Excel losing focus and non-updating userforms | Excel Programming | |||
Excel losing focus, but remains active ! | Excel Programming | |||
Adding And Deleting Sheets | Excel Programming |