Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Excel Workbook

Diana,

- - - - - - - - - - - - - - - - - - - - - - - - - -
Option Explicit
Sub Test()

Dim SHT As Worksheet

For Each SHT In Worksheets
SHT.Rows(1).Insert
Next

End Sub

- - - - - - - - - - - - - - - - - - - - - - - - - -


--
Regards,
Soo Cheon Jheong
_ _
^˘Ż^
--



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Excel Workbook

Excel workbook; how do I insert row in all worksheets?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Workbook

Sub AABB()
Worksheets.Select
Range("B7").EntireRow.Select
Selection.Insert
ActiveSheet.Select
End Sub

--
Regards,
Tom Ogilvy




"Diana" wrote in message
...
Excel workbook; how do I insert row in all worksheets?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Excel Workbook

Hi Diana,
You can shelect multiple sheets by pressing the shift or ctrl key while
selecting them , then all actions done to the active sheet is automatically
done to other selected sheets. Click a non-selected sheet or the active sheet
tab to ungroup them.
Programmatically: the bellow example selects/groups sheets sheet1 and
sheet2, and insert arow at 16.
Sheets(Array("Sheet1", "Sheet2")).Select
Rows("16:16").Insert Shift:=xlDown

Regards,
Sebastien
"Diana" wrote:

Excel workbook; how do I insert row in all worksheets?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Excel Workbook

Diana

Right-click on any sheet tab and "select all sheets".

Insert your row on active sheet and will be done to all sheets.

DO NOT FORGET to ungroup the sheets when task completed.

What you do to one sheet in a group is done to all.

Gord Dibben Excel MVP

On Sun, 5 Sep 2004 10:59:06 -0700, "Diana"
wrote:

Excel workbook; how do I insert row in all worksheets?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Workbook

What version of Excel? That doesn't work in Excel 97 or Excel 2000 (as
expected). VBA doesn't provide much support for grouped sheets. If you use
the selection object, you can get some of that functionality.

--
Regards,
Tom Ogilvy

"sebastienm" wrote in message
...
Hi Diana,
You can shelect multiple sheets by pressing the shift or ctrl key while
selecting them , then all actions done to the active sheet is

automatically
done to other selected sheets. Click a non-selected sheet or the active

sheet
tab to ungroup them.
Programmatically: the bellow example selects/groups sheets sheet1 and
sheet2, and insert arow at 16.
Sheets(Array("Sheet1", "Sheet2")).Select
Rows("16:16").Insert Shift:=xlDown

Regards,
Sebastien
"Diana" wrote:

Excel workbook; how do I insert row in all worksheets?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Excel Workbook

I only have xl2000 and the code works perfectly fine on my machine.

Regards,
SĂ©bastien

"Tom Ogilvy" wrote:

What version of Excel? That doesn't work in Excel 97 or Excel 2000 (as
expected). VBA doesn't provide much support for grouped sheets. If you use
the selection object, you can get some of that functionality.

--
Regards,
Tom Ogilvy

"sebastienm" wrote in message
...
Hi Diana,
You can shelect multiple sheets by pressing the shift or ctrl key while
selecting them , then all actions done to the active sheet is

automatically
done to other selected sheets. Click a non-selected sheet or the active

sheet
tab to ungroup them.
Programmatically: the bellow example selects/groups sheets sheet1 and
sheet2, and insert arow at 16.
Sheets(Array("Sheet1", "Sheet2")).Select
Rows("16:16").Insert Shift:=xlDown

Regards,
Sebastien
"Diana" wrote:

Excel workbook; how do I insert row in all worksheets?




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Workbook

think you need to look closer at the non active sheet. Sure you aren't
assuming the row was added there?

--
Regards,
Tom Ogilvy

"sebastienm" wrote in message
...
I only have xl2000 and the code works perfectly fine on my machine.

Regards,
Sébastien

"Tom Ogilvy" wrote:

What version of Excel? That doesn't work in Excel 97 or Excel 2000 (as
expected). VBA doesn't provide much support for grouped sheets. If you

use
the selection object, you can get some of that functionality.

--
Regards,
Tom Ogilvy

"sebastienm" wrote in message
...
Hi Diana,
You can shelect multiple sheets by pressing the shift or ctrl key

while
selecting them , then all actions done to the active sheet is

automatically
done to other selected sheets. Click a non-selected sheet or the

active
sheet
tab to ungroup them.
Programmatically: the bellow example selects/groups sheets sheet1 and
sheet2, and insert arow at 16.
Sheets(Array("Sheet1", "Sheet2")).Select
Rows("16:16").Insert Shift:=xlDown

Regards,
Sebastien
"Diana" wrote:

Excel workbook; how do I insert row in all worksheets?






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Excel Workbook

To confirm what Tom said, Sébastien's code does not work for me on
non-active albeit selected/grouped sheet(s) in my xl97 and xl2k.

However this from the macro recorder does:

Sheets(Array("Sheet1", "Sheet2")).Select
'Sheets("Sheet1").Activate 'recorded but not necessary
Rows("16:16").Select
Selection.Insert Shift:=xlDown

But Sébastien's "manual" tip works fine.

Regards,
Sandy

Tom Ogilvy wrote:

think you need to look closer at the non active sheet. Sure you aren't
assuming the row was added there?

"sebastienm" wrote in message

I only have xl2000 and the code works perfectly fine on my machine.

Regards,
Sébastien

"Tom Ogilvy" wrote:


What version of Excel? That doesn't work in Excel 97 or Excel

2000 (as
expected). VBA doesn't provide much support for grouped sheets.

If you

use

the selection object, you can get some of that functionality.

--
Regards,
Tom Ogilvy

"sebastienm" wrote in message
...


Hi Diana,
You can shelect multiple sheets by pressing the shift or ctrl key


while

selecting them , then all actions done to the active sheet is


automatically


done to other selected sheets. Click a non-selected sheet or the


active

sheet


tab to ungroup them.
Programmatically: the bellow example selects/groups sheets

sheet1 and
sheet2, and insert arow at 16.
Sheets(Array("Sheet1", "Sheet2")).Select
Rows("16:16").Insert Shift:=xlDown

Regards,
Sebastien
"Diana" wrote:


Excel workbook; how do I insert row in all worksheets?





  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Workbook

Sandy V,
Thanks for the confirmation.

As I said, using the selection object can get some things to work with
grouped sheets. The code I originally posted is similar to what you
recorded:

Sub AABB()
Worksheets.Select
Range("B7").EntireRow.Select
Selection.Insert
ActiveSheet.Select
End Sub

( the OP did say all sheets).

I had no contention with the manual methods Sébastien described - hope my
post was clear on that.

--
regards,
Tom Ogilvy


"Sandy V" wrote in message
...
To confirm what Tom said, Sébastien's code does not work for me on
non-active albeit selected/grouped sheet(s) in my xl97 and xl2k.

However this from the macro recorder does:

Sheets(Array("Sheet1", "Sheet2")).Select
'Sheets("Sheet1").Activate 'recorded but not necessary
Rows("16:16").Select
Selection.Insert Shift:=xlDown

But Sébastien's "manual" tip works fine.

Regards,
Sandy

Tom Ogilvy wrote:

think you need to look closer at the non active sheet. Sure you aren't
assuming the row was added there?

"sebastienm" wrote in message

I only have xl2000 and the code works perfectly fine on my machine.

Regards,
Sébastien





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Excel Workbook

Yes, you're right Tom. I had first recorded and checked the same code as
Sandy, but stupidly, i played a bit too much with the code before posting it
in its original form.

Regards,
SĂ©bastien

"Tom Ogilvy" wrote:

Sandy V,
Thanks for the confirmation.

As I said, using the selection object can get some things to work with
grouped sheets. The code I originally posted is similar to what you
recorded:

Sub AABB()
Worksheets.Select
Range("B7").EntireRow.Select
Selection.Insert
ActiveSheet.Select
End Sub

( the OP did say all sheets).

I had no contention with the manual methods SĂ©bastien described - hope my
post was clear on that.

--
regards,
Tom Ogilvy


"Sandy V" wrote in message
...
To confirm what Tom said, SĂ©bastien's code does not work for me on
non-active albeit selected/grouped sheet(s) in my xl97 and xl2k.

However this from the macro recorder does:

Sheets(Array("Sheet1", "Sheet2")).Select
'Sheets("Sheet1").Activate 'recorded but not necessary
Rows("16:16").Select
Selection.Insert Shift:=xlDown

But SĂ©bastien's "manual" tip works fine.

Regards,
Sandy

Tom Ogilvy wrote:

think you need to look closer at the non active sheet. Sure you aren't
assuming the row was added there?

"sebastienm" wrote in message

I only have xl2000 and the code works perfectly fine on my machine.

Regards,
SĂ©bastien




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
Excel-how to link source workbook to copy of destination workbook D Lynn Excel Worksheet Functions 1 May 29th 08 05:36 PM
when opening an Excel Workbook, another blank workbook also opens Gord Dibben Excel Discussion (Misc queries) 0 October 12th 07 09:49 PM
Excel workbook is corrupted, workbook automatically saves on start Paul Gooda Excel Discussion (Misc queries) 3 September 28th 06 04:51 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Excel Programming 5 December 20th 03 03:26 AM


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