Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default help with code

Hi,
I thought that this would work:

'*** NOTICE: This does not include the header row as we are adding on to the
bottom of
'what is already on BA Approved
Dim lastcell1 As Integer
lastcell1 = Range("A1").End(xlDown).Count
Range("A3:R(lastcell1)").Select
Range("R(lastcell1)").Activate
Selection.Copy
Sheets("Estimated - BA Approved").Select
'
'Find the first cell in column A WITHOUT Data and start paste in this cell
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste

It doesn't. First, can you tell me why? And two, is there simplier code
for selecting only rows with data, but not the two row header row?

Thanks,
Nicole
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default help with code


Dim lastRow As long 'not integer
dim DestCell as range

with worksheets("estimated - BA approved")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with worksheets("sheet99") '<-- change this
lastrow = .cells(.rows.count,"A").end(xlup).row

.range("a3:R" & lastrow).copy _
destination:=destcell
end with


====
I changed "As Integer" to "As Long". If the number of rows is small, then it
won't matter. But if the number of rows grows to big, it might--and "As Long"
always works.

I also changed LastCell1 to LastRow (too many ell's and ones, <vbg.)



Nicole Seibert wrote:

Hi,
I thought that this would work:

'*** NOTICE: This does not include the header row as we are adding on to the
bottom of
'what is already on BA Approved
Dim lastcell1 As Integer
lastcell1 = Range("A1").End(xlDown).Count
Range("A3:R(lastcell1)").Select
Range("R(lastcell1)").Activate
Selection.Copy
Sheets("Estimated - BA Approved").Select
'
'Find the first cell in column A WITHOUT Data and start paste in this cell
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste

It doesn't. First, can you tell me why? And two, is there simplier code
for selecting only rows with data, but not the two row header row?

Thanks,
Nicole


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default help with code

see possible answer to your later posting of this question.
--
Regards,
Tom Ogilvy


"Nicole Seibert" wrote:

Hi,
I thought that this would work:

'*** NOTICE: This does not include the header row as we are adding on to the
bottom of
'what is already on BA Approved
Dim lastcell1 As Integer
lastcell1 = Range("A1").End(xlDown).Count
Range("A3:R(lastcell1)").Select
Range("R(lastcell1)").Activate
Selection.Copy
Sheets("Estimated - BA Approved").Select
'
'Find the first cell in column A WITHOUT Data and start paste in this cell
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste

It doesn't. First, can you tell me why? And two, is there simplier code
for selecting only rows with data, but not the two row header row?

Thanks,
Nicole

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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


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