LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default if then else

Ok I'm not a VB programer.

However what I'm trying to do is copy a variable starting in cell A4 to D3
and then print (preview in this example) a report. Next the macro moves to
A5, copies the value in D3 and previews a report. Next the macro moves to
A6, copies the value in D3 and previews the report. Ok, I'm sure I'm
insulting you right now.

I have add "If Applicaition.ActiveCell = False Then Exit Sub" to stop
previewing the report when there is no longer a value in A6, A7, etc.

This approach is not very efficient because I don't know how to loop the
macro to to move down a cell, I'm actually typing the cell references in the
macro "R4C1", R5C1, etc. I'm sure this humoring you, but this is my 1st
attempt at this.

See below:

Application.Goto Reference:="R4C1"
If Application.ActiveCell = False Then Exit Sub
Application.CutCopyMode = False
Selection.Copy
Range("D3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintPreview
Application.Goto Reference:="R5C1"
If Application.ActiveCell = False Then Exit Sub
Selection.Copy
Range("D3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintPreview
Application.Goto Reference:="R6C1"
If Application.ActiveCell = False Then Exit Sub
Selection.Copy
Range("D3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintPreview
Application.Goto Reference:="R7C1"
If Application.ActiveCell = False Then Exit Sub




 
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



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

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"