Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Mary Ann
 
Posts: n/a
Default Macro €“ select all cells in current range

I have a file which has a summary sheet and a daily sheet. At the end of
each day I want to copy the data from the daily sheet to the summary sheet
and use a macro to do this.

My problem is that each day the number of rows I need to copy will vary.
The columns will remain the same.

Is there a way to instruct the macro to select all the cells in the current
range and for that to have a varying number of rows?

If I can do this by recording the action it would be easier for me.
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Macro – select all cells in current range

Mary Ann

You can try this macro.

Sub select_range()
Dim someCells As Range
With ActiveSheet.UsedRange
Range("A1").Select
Set someCells = ActiveSheet.Range(ActiveCell, _
.Cells(.Cells.Count))
End With
someCells.Copy Destination:=Sheets("Sheet2").Range("A1")
End Sub


Gord Dibben Excel MVP

On Sat, 10 Dec 2005 04:41:02 -0800, "Mary Ann"
wrote:

I have a file which has a summary sheet and a daily sheet. At the end of
each day I want to copy the data from the daily sheet to the summary sheet
and use a macro to do this.

My problem is that each day the number of rows I need to copy will vary.
The columns will remain the same.

Is there a way to instruct the macro to select all the cells in the current
range and for that to have a varying number of rows?

If I can do this by recording the action it would be easier for me.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Mary Ann
 
Posts: n/a
Default Macro - select all cells in current range

Thanks I'll try this

"Don Guillett" wrote:

use something like this
slastrow=cells(rows.count,"a").end(xlup).row
dlastrow=sheets("summary").cells(rows.count,"a").e nd(xlup).row
range("a2:x" & slastrow).copy sheets("summary").range("a" & dlastrow)

--
Don Guillett
SalesAid Software

"Mary Ann" wrote in message
...
I have a file which has a summary sheet and a daily sheet. At the end of
each day I want to copy the data from the daily sheet to the summary sheet
and use a macro to do this.

My problem is that each day the number of rows I need to copy will vary.
The columns will remain the same.

Is there a way to instruct the macro to select all the cells in the
current
range and for that to have a varying number of rows?

If I can do this by recording the action it would be easier for me.




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
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM
How to Select a relative range with Using "Find" and Offset() Dennis Excel Discussion (Misc queries) 7 July 27th 05 03:57 PM
monitoring a changing range of cells kevin Excel Discussion (Misc queries) 1 June 3rd 05 05:39 PM
monitoring a changing range of cells Kevin Excel Worksheet Functions 1 June 3rd 05 04:54 PM
How do I select a range if one cells contents is equal to another KHarrison Excel Discussion (Misc queries) 2 December 20th 04 09:35 PM


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