Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Copying a range of cells

I need to copy data from 1 worksheet and paste it in a
different worksheet. the range will always start with
cell C3 and end with a cell in column I. The number of
rows vary. How can I accomplish this? Here's what i have
so far:

Dim lngLastRow As String
Dim myStartColumn, myEndColumn As String

lngLastRow = myDataSheet.UsedRange.Rows.Count
myStartColumn = 3
myEndColumn = myStartColumn + 7

???

Any help will be appreciated.
MDC
  #2   Report Post  
Posted to microsoft.public.excel.programming
pk pk is offline
external usenet poster
 
Posts: 27
Default Copying a range of cells

The following does the trick for me rather concisely.
Note that the "Find" always finds the last "filled" row
on the sheet. The "copy" method used can be preceded by
your workbook name when copying to another book...

xLastRow = Cells.Find(What:="*", _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

Range("C3:I" & xLastRow).Select
Selection.Copy Destination:=Sheets("Sheet2").Range("A1")

Hope this helps you out...

-----Original Message-----
I need to copy data from 1 worksheet and paste it in a
different worksheet. the range will always start with
cell C3 and end with a cell in column I. The number of
rows vary. How can I accomplish this? Here's what i

have
so far:

Dim lngLastRow As String
Dim myStartColumn, myEndColumn As String

lngLastRow = myDataSheet.UsedRange.Rows.Count
myStartColumn = 3
myEndColumn = myStartColumn + 7

???

Any help will be appreciated.
MDC
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying a range of cells

have you tried
range("C1:I" & range("C1").end(xldown).row).copy

this should copy the range between C and I from row 1 down
to the first row with no data in it.
-----Original Message-----
I need to copy data from 1 worksheet and paste it in a
different worksheet. the range will always start with
cell C3 and end with a cell in column I. The number of
rows vary. How can I accomplish this? Here's what i

have
so far:

Dim lngLastRow As String
Dim myStartColumn, myEndColumn As String

lngLastRow = myDataSheet.UsedRange.Rows.Count
myStartColumn = 3
myEndColumn = myStartColumn + 7

???

Any help will be appreciated.
MDC
.

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
Copying a Range of Cells having data only shriil Excel Worksheet Functions 3 February 8th 09 09:36 PM
Copying rules set on a range of cells Chetski Excel Worksheet Functions 2 August 13th 08 02:15 AM
Copying A Range of Cells to Another Worksheet Rodman Excel Discussion (Misc queries) 4 May 6th 08 09:53 PM
Problem copying formula to range of cells Bob DePass Setting up and Configuration of Excel 0 July 22nd 05 02:09 AM
How do I skip blank cells when copying over a range of cells? tawells Excel Discussion (Misc queries) 2 June 7th 05 09:36 PM


All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"