Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default copying changing range

Hi,
I'm very new to all this and used the record macro function to copy part of
a range of data from one workbook to another using paste values only. Being a
complete beginner I was so pleased when it worked beautifully (my first time
:-) ) but then realised that the range will change each month as more data
added.

Could anyone please suggest a way to edit this macro so that it recognises
the end of the data entry. There are formulae in columns A, E and I-N in the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default copying changing range

untested, bu maybe something like this

Option Explicit
Dim lastrow As Long
Sub Macro1()
lastrow = Worksheets(1).Cells(Rows.Count, "N").End(xlUp).Row

'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'

Range("E3:N" & lastrow).Copy
Workbooks.Open _
Filename:="C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub


--


Gary


"Mifty" wrote in message
...
Hi,
I'm very new to all this and used the record macro function to copy part of
a range of data from one workbook to another using paste values only. Being a
complete beginner I was so pleased when it worked beautifully (my first time
:-) ) but then realised that the range will change each month as more data
added.

Could anyone please suggest a way to edit this macro so that it recognises
the end of the data entry. There are formulae in columns A, E and I-N in the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default copying changing range

Thanks Gary,
Will give it a go and let you know
Cheers
--
Mifty


"Gary Keramidas" wrote:

untested, bu maybe something like this

Option Explicit
Dim lastrow As Long
Sub Macro1()
lastrow = Worksheets(1).Cells(Rows.Count, "N").End(xlUp).Row

'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'

Range("E3:N" & lastrow).Copy
Workbooks.Open _
Filename:="C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub


--


Gary


"Mifty" wrote in message
...
Hi,
I'm very new to all this and used the record macro function to copy part of
a range of data from one workbook to another using paste values only. Being a
complete beginner I was so pleased when it worked beautifully (my first time
:-) ) but then realised that the range will change each month as more data
added.

Could anyone please suggest a way to edit this macro so that it recognises
the end of the data entry. There are formulae in columns A, E and I-N in the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default copying changing range

Sorry Gary,
I'm really struggling with this. Can you give me more help?
How do I specify the range I want (which is E3 to Nx)
and how do I incorporate your bit into the recorded macro?

I would be very grateful for any help. I know I'm trying to run before I can
walk but I'm hoping that once it is working I can come back to decipher it
and learn that way. Not too presumptuous I hope!
Cheers
--
Mifty


"Mifty" wrote:

Thanks Gary,
Will give it a go and let you know
Cheers
--
Mifty


"Gary Keramidas" wrote:

untested, bu maybe something like this

Option Explicit
Dim lastrow As Long
Sub Macro1()
lastrow = Worksheets(1).Cells(Rows.Count, "N").End(xlUp).Row

'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'

Range("E3:N" & lastrow).Copy
Workbooks.Open _
Filename:="C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub


--


Gary


"Mifty" wrote in message
...
Hi,
I'm very new to all this and used the record macro function to copy part of
a range of data from one workbook to another using paste values only. Being a
complete beginner I was so pleased when it worked beautifully (my first time
:-) ) but then realised that the range will change each month as more data
added.

Could anyone please suggest a way to edit this macro so that it recognises
the end of the data entry. There are formulae in columns A, E and I-N in the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default copying changing range

probably need some more info.

the lastrow variable finds the lastrow in column N. so the copy statement copies
E3:N and whatever the lastrow is.

but not knowing anything else, it's kind of hard to go any further

--


Gary


"Mifty" wrote in message
...
Sorry Gary,
I'm really struggling with this. Can you give me more help?
How do I specify the range I want (which is E3 to Nx)
and how do I incorporate your bit into the recorded macro?

I would be very grateful for any help. I know I'm trying to run before I can
walk but I'm hoping that once it is working I can come back to decipher it
and learn that way. Not too presumptuous I hope!
Cheers
--
Mifty


"Mifty" wrote:

Thanks Gary,
Will give it a go and let you know
Cheers
--
Mifty


"Gary Keramidas" wrote:

untested, bu maybe something like this

Option Explicit
Dim lastrow As Long
Sub Macro1()
lastrow = Worksheets(1).Cells(Rows.Count, "N").End(xlUp).Row

'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'

Range("E3:N" & lastrow).Copy
Workbooks.Open _
Filename:="C:\Documents and Settings\TEMP\My
Documents\Destination.xls"
Range("A3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub


--


Gary


"Mifty" wrote in message
...
Hi,
I'm very new to all this and used the record macro function to copy part
of
a range of data from one workbook to another using paste values only.
Being a
complete beginner I was so pleased when it worked beautifully (my first
time
:-) ) but then realised that the range will change each month as more
data
added.

Could anyone please suggest a way to edit this macro so that it
recognises
the end of the data entry. There are formulae in columns A, E and I-N in
the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default copying changing range

H Mifty,

This may help. Put some data in column N. Copy and paste this in the sheet
module and then run it.

Dim lastrow As Long
Sub LastRowNo()
lastrow = Worksheets(1).Cells(Rows.Count, "N").End(xlUp).Row
MsgBox lastrow
End If

You should get a message box with a number in it which is the same as the
last row of column N that has a value in it. Lets say the message box
return 26.

Now since lastrow = 26, this line of code from Gary's solution:
Range("E3:N" & lastrow).Copy

is the same as Range("E3:N26").Copy

So, when the length of data in column N changes the the range that is to be
copied changes with it.

HTH
Regards,
Howard


"Mifty" wrote in message
...
Hi,
I'm very new to all this and used the record macro function to copy part
of
a range of data from one workbook to another using paste values only.
Being a
complete beginner I was so pleased when it worked beautifully (my first
time
:-) ) but then realised that the range will change each month as more data
added.

Could anyone please suggest a way to edit this macro so that it recognises
the end of the data entry. There are formulae in columns A, E and I-N in
the
source workbook

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/02/2006 by Mifty
'
' Keyboard Shortcut: Ctrl+a
'
Range("E3:N10").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\TEMP\My Documents\Destination.xls"
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

Many thanks
--

Mifty



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
Changing the range for averages with out changing the formula. JessLRC Excel Worksheet Functions 0 April 20th 10 03:10 PM
Copying formulas without changing the range gaelicamethyst Excel Discussion (Misc queries) 2 March 24th 09 03:41 PM
COPYING OFFSET FORMULA WITHOUT THE DATA RANGE CHANGING-DESPERATE SHELL Excel Worksheet Functions 5 August 10th 08 02:00 AM
Copying a named range with a changing cell reference [email protected] New Users to Excel 1 February 21st 08 07:49 AM
Selecting & Copying a Changing Range DNewton[_3_] Excel Programming 2 May 3rd 04 03:44 PM


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