Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Need exit Sub modification

Thanks in advance for your continued help.

The code below currently exits/End Sub when the Row in
column N is blank. Since it is possible for row N# to be
blank I need the code to exit only when both column M and
N are blank on the same row. Otherwise, the code works
fine. Thanks again. Dan

Sub mcrCopyToFinal()
Worksheets("ScrubData").Activate
Dim Rng As Range
Dim i As Integer
Dim Dest As Range
Set Rng = Sheets("ScrubData").Range("N2")
If Sheets("Final").Range("A1") = "" Then
Set Dest = Sheets("Final").Range("A2")
Else
Set Dest = Sheets("Final").Range("A65536").End(xlUp)
End If
While Rng < ""
While Rng.Offset(0, i) < ""
Rng.Offset(0, i).copy Dest
Range(Rng.Offset(0, -13), Rng.Offset(0, -1)).copy
Dest.Offset(0, 1)
Set Dest = Dest.Offset(1, 0)
i = i + 1
Wend
Set Rng = Rng.Offset(1, 0)
i = 0
Wend

Set Rng = Nothing

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need exit Sub modification

Is this what you want

While Rng.Offset(0, i) < "" ANd Rng.Offset(0, i + 1) < ""

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dan" wrote in message
...
Thanks in advance for your continued help.

The code below currently exits/End Sub when the Row in
column N is blank. Since it is possible for row N# to be
blank I need the code to exit only when both column M and
N are blank on the same row. Otherwise, the code works
fine. Thanks again. Dan

Sub mcrCopyToFinal()
Worksheets("ScrubData").Activate
Dim Rng As Range
Dim i As Integer
Dim Dest As Range
Set Rng = Sheets("ScrubData").Range("N2")
If Sheets("Final").Range("A1") = "" Then
Set Dest = Sheets("Final").Range("A2")
Else
Set Dest = Sheets("Final").Range("A65536").End(xlUp)
End If
While Rng < ""
While Rng.Offset(0, i) < ""
Rng.Offset(0, i).copy Dest
Range(Rng.Offset(0, -13), Rng.Offset(0, -1)).copy
Dest.Offset(0, 1)
Set Dest = Dest.Offset(1, 0)
i = i + 1
Wend
Set Rng = Rng.Offset(1, 0)
i = 0
Wend

Set Rng = Nothing

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
Modification of a .CSV file [email protected] Excel Discussion (Misc queries) 6 April 23rd 07 09:11 PM
last modification Chip Smith Excel Discussion (Misc queries) 1 June 19th 06 11:55 PM
Modification Steved[_3_] Excel Programming 2 September 8th 04 08:09 PM
Need Macro Modification Phil Hageman[_3_] Excel Programming 2 June 2nd 04 12:26 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


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