Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default macro to copy only range with data

HI...

my data range area is from A1:B5.....
How I going to copy only the range with data... ( my range of data keep on
changing but within A1:B5.

e.g the data is located at A1:B2, so the macro will ignore A3:B5.

rgds

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default macro to copy only range with data

Hi,

Try this

Range("A1:B" & Range("B6").End(xlUp).Row).Copy

Note B6 isn't a typo, this works for A1 - B5

Mike

"ramzi" wrote:

HI...

my data range area is from A1:B5.....
How I going to copy only the range with data... ( my range of data keep on
changing but within A1:B5.

e.g the data is located at A1:B2, so the macro will ignore A3:B5.

rgds

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default macro to copy only range with data

Hi Mike,

my original macro is below...

Range("d9:j15,O9:O15").Copy

lastrow = Sheets("sale").Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1
Sheets("sale").Range("A" & lastrow).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


but my data not always from row 9 to 15 , sometime only at row 9 or only at
row 9 to 10...
I need macro to pick up the watever written in row form 9 to 15.. if row 15
is blank the macro will select row 9 to 14 and do copy paste.

thanks










"Mike H" wrote:

Hi,

Try this

Range("A1:B" & Range("B6").End(xlUp).Row).Copy

Note B6 isn't a typo, this works for A1 - B5

Mike

"ramzi" wrote:

HI...

my data range area is from A1:B5.....
How I going to copy only the range with data... ( my range of data keep on
changing but within A1:B5.

e.g the data is located at A1:B2, so the macro will ignore A3:B5.

rgds

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
macro to copy range Frank Situmorang[_2_] Excel Worksheet Functions 7 June 3rd 08 09:54 AM
Copy Range Data Macro Cheri Excel Discussion (Misc queries) 9 April 12th 08 03:46 AM
Need help - Macro to copy a specific range Dileep Chandran Excel Worksheet Functions 0 December 4th 06 10:24 AM
MACRO TO COPY TO A RANGE asuncionw Excel Discussion (Misc queries) 3 February 9th 06 04:39 PM
Macro to copy range of formulas to equal data lines lh Excel Worksheet Functions 2 August 15th 05 04:37 PM


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