#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Conditional Macro

Hi Everyone, I would love your help with this one!

I have a Workbook consisting of several worksheets.
The begining columns are the same on each worksheet.
This spreadsheet will have many rows added to it near the top
Those rows need to be copied to each worksheet.

I created a macro so when someone adds a row to the 1st worksheet, it will
add part of that row to all of the other worksheets.

I need to prevent the following scenario: Someone adds row to 1st
spreadsheet, runs macro (great...adds rows to other worksheets). They run
macro again without adding row (bad...adds same row to other worksheets).

Here is my current Marcro:

Sub AddNewEnhancement()
'
' AddNewEnhancement Macro
' Macro recorded 3/7/2007 by Stacey Shearn
'
' Keyboard Shortcut: Ctrl+e
'
Range("E6").Select
Selection.AutoFill Destination:=Range("E4:E6"), Type:=xlFillDefault
Range("E4:E6").Select
Range("J6").Select
Selection.AutoFill Destination:=Range("J4:J6"), Type:=xlFillDefault
Range("J4:J6").Select
ActiveWindow.LargeScroll ToRight:=1
Range("R6").Select
Selection.AutoFill Destination:=Range("R4:R6"), Type:=xlFillDefault
Range("R4:R6").Select
ActiveWindow.LargeScroll ToRight:=-1
Sheets("Sheet1").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5").Select
Sheets("Sheet2").Select
Range("A5:D5").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("Sheet2").Select
Application.CutCopyMode = False
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Conditional Macro

How about using a column in the first sheet as a copied marker.

Once the row has been copied, the marker would get set to "1"

That way the macro could check to see if a row has already been copied.
--
Gary''s Student
gsnu200709


"Stacey" wrote:

Hi Everyone, I would love your help with this one!

I have a Workbook consisting of several worksheets.
The begining columns are the same on each worksheet.
This spreadsheet will have many rows added to it near the top
Those rows need to be copied to each worksheet.

I created a macro so when someone adds a row to the 1st worksheet, it will
add part of that row to all of the other worksheets.

I need to prevent the following scenario: Someone adds row to 1st
spreadsheet, runs macro (great...adds rows to other worksheets). They run
macro again without adding row (bad...adds same row to other worksheets).

Here is my current Marcro:

Sub AddNewEnhancement()
'
' AddNewEnhancement Macro
' Macro recorded 3/7/2007 by Stacey Shearn
'
' Keyboard Shortcut: Ctrl+e
'
Range("E6").Select
Selection.AutoFill Destination:=Range("E4:E6"), Type:=xlFillDefault
Range("E4:E6").Select
Range("J6").Select
Selection.AutoFill Destination:=Range("J4:J6"), Type:=xlFillDefault
Range("J4:J6").Select
ActiveWindow.LargeScroll ToRight:=1
Range("R6").Select
Selection.AutoFill Destination:=Range("R4:R6"), Type:=xlFillDefault
Range("R4:R6").Select
ActiveWindow.LargeScroll ToRight:=-1
Sheets("Sheet1").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5").Select
Sheets("Sheet2").Select
Range("A5:D5").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("Sheet2").Select
Application.CutCopyMode = False
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Conditional Macro

Thanks for the suggestion! I don't know how to implement that though. Would
you please give me some more details?

Thank you!

"Gary''s Student" wrote:

How about using a column in the first sheet as a copied marker.

Once the row has been copied, the marker would get set to "1"

That way the macro could check to see if a row has already been copied.
--
Gary''s Student
gsnu200709


"Stacey" wrote:

Hi Everyone, I would love your help with this one!

I have a Workbook consisting of several worksheets.
The begining columns are the same on each worksheet.
This spreadsheet will have many rows added to it near the top
Those rows need to be copied to each worksheet.

I created a macro so when someone adds a row to the 1st worksheet, it will
add part of that row to all of the other worksheets.

I need to prevent the following scenario: Someone adds row to 1st
spreadsheet, runs macro (great...adds rows to other worksheets). They run
macro again without adding row (bad...adds same row to other worksheets).

Here is my current Marcro:

Sub AddNewEnhancement()
'
' AddNewEnhancement Macro
' Macro recorded 3/7/2007 by Stacey Shearn
'
' Keyboard Shortcut: Ctrl+e
'
Range("E6").Select
Selection.AutoFill Destination:=Range("E4:E6"), Type:=xlFillDefault
Range("E4:E6").Select
Range("J6").Select
Selection.AutoFill Destination:=Range("J4:J6"), Type:=xlFillDefault
Range("J4:J6").Select
ActiveWindow.LargeScroll ToRight:=1
Range("R6").Select
Selection.AutoFill Destination:=Range("R4:R6"), Type:=xlFillDefault
Range("R4:R6").Select
ActiveWindow.LargeScroll ToRight:=-1
Sheets("Sheet1").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5").Select
Sheets("Sheet2").Select
Range("A5:D5").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
Sheets("Sheet2").Select
Application.CutCopyMode = False
End Sub

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
Conditional Formatting in a Macro Ed Excel Discussion (Misc queries) 2 August 28th 06 11:23 PM
Conditional Formatting in Macro shantanu oak Excel Discussion (Misc queries) 2 July 14th 06 01:11 PM
[B]Conditional Macro?[/B] Heydilbert Excel Discussion (Misc queries) 1 November 11th 05 10:07 PM
conditional sum and macro Francine Otterson Excel Discussion (Misc queries) 1 June 22nd 05 09:44 AM
Conditional Macro Shelley Shepherd via OfficeKB.com Excel Worksheet Functions 1 February 1st 05 05:32 PM


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