Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default How to copy and paste a partial row (i.e. not the EntireRow)

I am looking to copy only a segement of a row from a primary database to a
summary sheet. Currently, my script below copies the EntireRow
(c.EntireRow.Copy_). Is there a way to set a range such that I only copy
over...say "d to Z" versus the EntireRow?

Sub Rectangle2_Click()

CodeName = InputBox("Enter Project Code", Range("a1:a3").Find(Cells(1,
1)).Offset(rowOffset:=2, columnOffset:=1).Value)

Range("a1:a5").Find(Cells(1, 1)).Offset(rowOffset:=1, columnOffset:=2).Value
= CodeName

Worksheets("Extract").Select
Worksheets("Extract").Range("a8:z2000").ClearConte nts

RowCount = 8

With Worksheets("Database").Range("a1:z2000")
Set c = .Find(Cells(3, 2))

If Not c Is Nothing Then
firstAddress = c.Address
Do

c.EntireRow.Copy _
Destination:=Worksheets("APTS Extract").Rows(RowCount)
RowCount = RowCount + 1

Set c = .FindNext(c)

Loop While Not c Is Nothing And c.Address < firstAddress
End If

End With

End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default How to copy and paste a partial row (i.e. not the EntireRow)

Sorry, I forgot to include the dot for the WITH

.Range(cells(c.row,"d"),cells(c.row,"z")).copy
or
.Range(.cells(c.row,"d"),.cells(c.row,"z")).copy


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
Don,

Thanks for the response!

I've replace "c.EntireRow" with your script
"Range(cells(c.row,"d"),cells(c.row,"z")).copy and get a "Run-time
error'1004". Your further assistance is greatly appreciated!

"Don Guillett" wrote:

Range(cells(c.row,"d"),cells(c.row,"z")).copy

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
I am looking to copy only a segement of a row from a primary database to
a
summary sheet. Currently, my script below copies the EntireRow
(c.EntireRow.Copy_). Is there a way to set a range such that I only
copy
over...say "d to Z" versus the EntireRow?

Sub Rectangle2_Click()

CodeName = InputBox("Enter Project Code", Range("a1:a3").Find(Cells(1,
1)).Offset(rowOffset:=2, columnOffset:=1).Value)

Range("a1:a5").Find(Cells(1, 1)).Offset(rowOffset:=1,
columnOffset:=2).Value
= CodeName

Worksheets("Extract").Select
Worksheets("Extract").Range("a8:z2000").ClearConte nts

RowCount = 8

With Worksheets("Database").Range("a1:z2000")
Set c = .Find(Cells(3, 2))

If Not c Is Nothing Then
firstAddress = c.Address
Do

c.EntireRow.Copy _
Destination:=Worksheets("APTS Extract").Rows(RowCount)
RowCount = RowCount + 1

Set c = .FindNext(c)

Loop While Not c Is Nothing And c.Address < firstAddress
End If

End With

End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default How to copy and paste a partial row (i.e. not the EntireRow)

Don,

Thanks!!.....it runs great (I had placed dots in several locations but could
not get the correct order).

Thanks again for all your help!,

Chris

"Don Guillett" wrote:

Sorry, I forgot to include the dot for the WITH

.Range(cells(c.row,"d"),cells(c.row,"z")).copy
or
.Range(.cells(c.row,"d"),.cells(c.row,"z")).copy


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
Don,

Thanks for the response!

I've replace "c.EntireRow" with your script
"Range(cells(c.row,"d"),cells(c.row,"z")).copy and get a "Run-time
error'1004". Your further assistance is greatly appreciated!

"Don Guillett" wrote:

Range(cells(c.row,"d"),cells(c.row,"z")).copy

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
I am looking to copy only a segement of a row from a primary database to
a
summary sheet. Currently, my script below copies the EntireRow
(c.EntireRow.Copy_). Is there a way to set a range such that I only
copy
over...say "d to Z" versus the EntireRow?

Sub Rectangle2_Click()

CodeName = InputBox("Enter Project Code", Range("a1:a3").Find(Cells(1,
1)).Offset(rowOffset:=2, columnOffset:=1).Value)

Range("a1:a5").Find(Cells(1, 1)).Offset(rowOffset:=1,
columnOffset:=2).Value
= CodeName

Worksheets("Extract").Select
Worksheets("Extract").Range("a8:z2000").ClearConte nts

RowCount = 8

With Worksheets("Database").Range("a1:z2000")
Set c = .Find(Cells(3, 2))

If Not c Is Nothing Then
firstAddress = c.Address
Do

c.EntireRow.Copy _
Destination:=Worksheets("APTS Extract").Rows(RowCount)
RowCount = RowCount + 1

Set c = .FindNext(c)

Loop While Not c Is Nothing And c.Address < firstAddress
End If

End With

End Sub






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default How to copy and paste a partial row (i.e. not the EntireRow)

Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
Don,

Thanks!!.....it runs great (I had placed dots in several locations but
could
not get the correct order).

Thanks again for all your help!,

Chris

"Don Guillett" wrote:

Sorry, I forgot to include the dot for the WITH

.Range(cells(c.row,"d"),cells(c.row,"z")).copy
or
.Range(.cells(c.row,"d"),.cells(c.row,"z")).copy


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
Don,

Thanks for the response!

I've replace "c.EntireRow" with your script
"Range(cells(c.row,"d"),cells(c.row,"z")).copy and get a "Run-time
error'1004". Your further assistance is greatly appreciated!

"Don Guillett" wrote:

Range(cells(c.row,"d"),cells(c.row,"z")).copy

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CROD" wrote in message
...
I am looking to copy only a segement of a row from a primary database
to
a
summary sheet. Currently, my script below copies the EntireRow
(c.EntireRow.Copy_). Is there a way to set a range such that I only
copy
over...say "d to Z" versus the EntireRow?

Sub Rectangle2_Click()

CodeName = InputBox("Enter Project Code",
Range("a1:a3").Find(Cells(1,
1)).Offset(rowOffset:=2, columnOffset:=1).Value)

Range("a1:a5").Find(Cells(1, 1)).Offset(rowOffset:=1,
columnOffset:=2).Value
= CodeName

Worksheets("Extract").Select
Worksheets("Extract").Range("a8:z2000").ClearConte nts

RowCount = 8

With Worksheets("Database").Range("a1:z2000")
Set c = .Find(Cells(3, 2))

If Not c Is Nothing Then
firstAddress = c.Address
Do

c.EntireRow.Copy _
Destination:=Worksheets("APTS Extract").Rows(RowCount)
RowCount = RowCount + 1

Set c = .FindNext(c)

Loop While Not c Is Nothing And c.Address < firstAddress
End If

End With

End Sub





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
.Copy partial value Bishop Excel Worksheet Functions 1 August 11th 09 07:20 PM
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Discussion (Misc queries) 1 July 20th 09 07:11 PM
MACRO: Selecting "Cancel" from a drop down to copy and paste entirerow to another sheet Nicole Hannington Excel Worksheet Functions 1 July 20th 09 06:51 PM
Partial copy DP7 Excel Programming 2 February 9th 07 04:42 PM
find specific data in row and select and copy entirerow Junior728 Excel Programming 3 August 8th 05 01:31 PM


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