Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
WH
 
Posts: n/a
Default Conditional Copy Paste Macro

I want to creat a conditional macro that if say Sheet1 has data copy the data
to Sheet2, but if Sheet1 is blank do nothing and go on to the next macro.
Can anyone help. Thank you in advance.

Bill
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Conditional Copy Paste Macro

This is an example that only looks at one cell:


Sub Macro1()
Call Macro10
Call Macro11
End Sub

Sub Macro11()
MsgBox ("IN 11")
End Sub

Sub Macro10()
Dim r1, r2 As Range
Set r1 = Worksheets("Sheet1").Range("A1")
Set r2 = Worksheets("Sheet2").Range("A1")
If r1.Value = "" Then
Else
r1.Copy r2
End If
End Sub

Macro10 is the conditional one. If A1 in sheet1 is empty, Macro 10 just
exits. Otherwise it does the copy before exiting
--
Gary's Student


"WH" wrote:

I want to creat a conditional macro that if say Sheet1 has data copy the data
to Sheet2, but if Sheet1 is blank do nothing and go on to the next macro.
Can anyone help. Thank you in advance.

Bill

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
macro to copy and paste into another workbook spirosu Excel Discussion (Misc queries) 1 March 15th 06 06:26 PM
Copy & Paste macro sparx Excel Worksheet Functions 3 September 13th 05 05:08 AM
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
Copy Paste macro GWB Direct Excel Discussion (Misc queries) 2 May 9th 05 03:31 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"