Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding/Removing Rows to Referenced Ranged in Worksheet

Hello,

I have an Excel workbook with many worksheets. The first worksheet (Sheet1)
will be need to be referenced in all other worksheets. This has been
straight-forward until i added a new row to the first worksheet. How could I
setup the workbook such that if I change/add/remove row from Sheet1, it will
do the same to the other worksheets without overwriting rows that are
appended below the referencing cells?

Please see example below. Thank you for any help and sorry if the
illustration below is overkill. I just wanted to make it clear as possible.

Brandon

To illustate, I have Sheet1 as follows:

Apple
Boat
Carpet
Dog

And, Sheet2 with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Event
Flag

And, Sheet3 again with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Giraffe
Hippo

Now, if I remove rows in Sheet1 to be:

Apple
Dog

Then, I'd like to have Sheet2 & Sheet3 to be, respectively:

(Apple)
(Dog)
Event
Flag

(Apple)
(Dog)
Giraffe
Hippo

Also, in addition, if I add rows to Sheet1 to be:

Apple
Boat
Carpet
Dog
Elephant

Then, Sheet2 & Sheet3 should be as follows:

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Event
Flag

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Giraffe
Hippo




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Adding/Removing Rows to Referenced Ranged in Worksheet

Rather than talk in terms of deleting rows, I would refer to deleting data.
If I delete Boat and Carpet from sheet one and I want to delete it from all
sheets with all associated data on those rows, it becomes easier.

Sub delredund()
Dim sh As Worksheet, c As Range
For Each sh In ActiveWorkbook.Sheets
Set c = Cells.Find("Boat", LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Set c = Cells.Find("Carpet"), LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Next
End Sub

Code is untested.


"Brandon Arnieri" wrote:

Hello,

I have an Excel workbook with many worksheets. The first worksheet (Sheet1)
will be need to be referenced in all other worksheets. This has been
straight-forward until i added a new row to the first worksheet. How could I
setup the workbook such that if I change/add/remove row from Sheet1, it will
do the same to the other worksheets without overwriting rows that are
appended below the referencing cells?

Please see example below. Thank you for any help and sorry if the
illustration below is overkill. I just wanted to make it clear as possible.

Brandon

To illustate, I have Sheet1 as follows:

Apple
Boat
Carpet
Dog

And, Sheet2 with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Event
Flag

And, Sheet3 again with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Giraffe
Hippo

Now, if I remove rows in Sheet1 to be:

Apple
Dog

Then, I'd like to have Sheet2 & Sheet3 to be, respectively:

(Apple)
(Dog)
Event
Flag

(Apple)
(Dog)
Giraffe
Hippo

Also, in addition, if I add rows to Sheet1 to be:

Apple
Boat
Carpet
Dog
Elephant

Then, Sheet2 & Sheet3 should be as follows:

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Event
Flag

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Giraffe
Hippo




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Adding/Removing Rows to Referenced Ranged in Worksheet

The addition of rows could be done with a similar loop, you would just have
to tell it where to Insert (and that is the key word) the rows.

"Brandon Arnieri" wrote:

Hello,

I have an Excel workbook with many worksheets. The first worksheet (Sheet1)
will be need to be referenced in all other worksheets. This has been
straight-forward until i added a new row to the first worksheet. How could I
setup the workbook such that if I change/add/remove row from Sheet1, it will
do the same to the other worksheets without overwriting rows that are
appended below the referencing cells?

Please see example below. Thank you for any help and sorry if the
illustration below is overkill. I just wanted to make it clear as possible.

Brandon

To illustate, I have Sheet1 as follows:

Apple
Boat
Carpet
Dog

And, Sheet2 with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Event
Flag

And, Sheet3 again with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Giraffe
Hippo

Now, if I remove rows in Sheet1 to be:

Apple
Dog

Then, I'd like to have Sheet2 & Sheet3 to be, respectively:

(Apple)
(Dog)
Event
Flag

(Apple)
(Dog)
Giraffe
Hippo

Also, in addition, if I add rows to Sheet1 to be:

Apple
Boat
Carpet
Dog
Elephant

Then, Sheet2 & Sheet3 should be as follows:

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Event
Flag

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Giraffe
Hippo




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Adding/Removing Rows to Referenced Ranged in Worksheet

Correct typo:

Set c = Cells.Find("Carpet", LookIn:=xlValues)


"JLGWhiz" wrote:

Rather than talk in terms of deleting rows, I would refer to deleting data.
If I delete Boat and Carpet from sheet one and I want to delete it from all
sheets with all associated data on those rows, it becomes easier.

Sub delredund()
Dim sh As Worksheet, c As Range
For Each sh In ActiveWorkbook.Sheets
Set c = Cells.Find("Boat", LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Set c = Cells.Find("Carpet"), LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Next
End Sub

Code is untested.


"Brandon Arnieri" wrote:

Hello,

I have an Excel workbook with many worksheets. The first worksheet (Sheet1)
will be need to be referenced in all other worksheets. This has been
straight-forward until i added a new row to the first worksheet. How could I
setup the workbook such that if I change/add/remove row from Sheet1, it will
do the same to the other worksheets without overwriting rows that are
appended below the referencing cells?

Please see example below. Thank you for any help and sorry if the
illustration below is overkill. I just wanted to make it clear as possible.

Brandon

To illustate, I have Sheet1 as follows:

Apple
Boat
Carpet
Dog

And, Sheet2 with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Event
Flag

And, Sheet3 again with cells referencing Sheet1 in parentheses:

(Apple)
(Boat)
(Carpet)
(Dog)
Giraffe
Hippo

Now, if I remove rows in Sheet1 to be:

Apple
Dog

Then, I'd like to have Sheet2 & Sheet3 to be, respectively:

(Apple)
(Dog)
Event
Flag

(Apple)
(Dog)
Giraffe
Hippo

Also, in addition, if I add rows to Sheet1 to be:

Apple
Boat
Carpet
Dog
Elephant

Then, Sheet2 & Sheet3 should be as follows:

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Event
Flag

(Apple)
(Boat)
(Carpet)
(Dog)
(Elephant)
Giraffe
Hippo




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 or removing rows Chris Excel Discussion (Misc queries) 12 January 10th 10 12:48 PM
Adding/Removing Rows Automatically. GEM Excel Discussion (Misc queries) 1 March 20th 09 12:50 AM
Automatically Adding Time based on a name ranged Cathy Excel Discussion (Misc queries) 1 February 27th 08 02:13 AM
Adding Named ranged for each column... [email protected] Excel Programming 2 December 1st 06 03:30 AM
Adding/removing rows in Excel Don[_12_] Excel Programming 1 November 10th 03 02:10 PM


All times are GMT +1. The time now is 03:11 AM.

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"