Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Need help with modify this macro to copy.

This macro show the last cell in a sheet that has an empty row. I want it to
copy all rows from A16 till the last row in the sheet that is not empty or
looks empty.
I can't use .End(xlUp) since that copies empy cells with formulas in them.

Sub testme()

Dim myCell As Range
Dim NextEmpty As Range

Set myCell = ActiveSheet.Range("a16")
Do
If myCell.Value = "" Then
Set NextEmpty = myCell
Exit Do
Else
Set myCell = myCell.Offset(1, 0)
End If
Loop

MsgBox NextEmpty.Address

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need help with modify this macro to copy.

Sub testme()

Dim myCell As Range
Dim NextEmpty As Range

Set myCell = ActiveSheet.Range("a16")
Do
If myCell.Value = "" Then
Set NextEmpty = myCell
Exit Do
Else
Set myCell = myCell.Offset(1, 0)
End If
Loop
Range("A16", NextEmpty.offset(-1,0).EntireRow.copy _
Destination:=Worksheets(2).Range("A1")
End Sub

--
Regards,
Tom Ogilvy


"Calle" wrote in message
...
This macro show the last cell in a sheet that has an empty row. I want it
to
copy all rows from A16 till the last row in the sheet that is not empty or
looks empty.
I can't use .End(xlUp) since that copies empy cells with formulas in them.

Sub testme()

Dim myCell As Range
Dim NextEmpty As Range

Set myCell = ActiveSheet.Range("a16")
Do
If myCell.Value = "" Then
Set NextEmpty = myCell
Exit Do
Else
Set myCell = myCell.Offset(1, 0)
End If
Loop

MsgBox NextEmpty.Address

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Need help with modify this macro to copy.

Hi Tom!
I get an error message with these to lines:

Range("A16", NextEmpty.offset(-1,0).EntireRow.copy _
Destination:=Worksheets(2).Range("A1")
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need help with modify this macro to copy.

since that was too hard to debug and correct yourself, I will post the
tested routine

Sub testme()

Dim myCell As Range
Dim NextEmpty As Range

Set myCell = ActiveSheet.Range("a16")
Do
If myCell.Value = "" Then
Set NextEmpty = myCell
Exit Do
Else
Set myCell = myCell.Offset(1, 0)
End If
Loop
Range("A16", NextEmpty.Offset(-1, 0)).EntireRow.Copy _
Destination:=Worksheets(2).Range("A1")
End Sub

--
regards,
Tom Ogilvy

"Calle" wrote in message
...
Hi Tom!
I get an error message with these to lines:

Range("A16", NextEmpty.offset(-1,0).EntireRow.copy _
Destination:=Worksheets(2).Range("A1")



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
I need to modify my macro ... Dr. Darrell Excel Discussion (Misc queries) 0 February 24th 10 07:21 PM
How do I copy a graph that I want to modify in powerpoint? Ipata Charts and Charting in Excel 1 May 12th 09 01:37 PM
Modify macro to copy to next available row Liketoknow Excel Discussion (Misc queries) 0 August 23rd 06 10:10 PM
How to modify a copy macro EAHRENS Excel Worksheet Functions 4 March 13th 06 06:58 PM
Help to modify macro please Brian Tozer Excel Programming 2 December 28th 03 08:24 PM


All times are GMT +1. The time now is 06:57 PM.

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"