Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trouble with a macro - copying cells

Having trouble coming up with a macro to do the following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to cells
A, C, & F of sheet "Labor Costing" respectively, starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me know.

Any help would be appreciated,

TIA,
Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Trouble with a macro - copying cells

Hi
as a starting point:
http://www.rondebruin.nl/copy5.htm

--
Regards
Frank Kabel
Frankfurt, Germany


ToddG wrote:
Having trouble coming up with a macro to do the following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to cells
A, C, & F of sheet "Labor Costing" respectively, starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me know.

Any help would be appreciated,

TIA,
Todd

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Trouble with a macro - copying cells

Not tested, but try this

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor Costing").Range("C24")
Range("L & oCell.Row).Copy Worksheets("Labor Costing").Range("F24")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ToddG" wrote in message
...
Having trouble coming up with a macro to do the following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to cells
A, C, & F of sheet "Labor Costing" respectively, starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me know.

Any help would be appreciated,

TIA,
Todd



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Trouble with a macro - copying cells

Slight type

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor
Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor
Costing").Range("C24")
Range("L" & oCell.Row).Copy Worksheets("Labor
Costing").Range("F24")
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote in message
...
Not tested, but try this

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor

Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor

Costing").Range("C24")
Range("L & oCell.Row).Copy Worksheets("Labor

Costing").Range("F24")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ToddG" wrote in message
...
Having trouble coming up with a macro to do the following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to cells
A, C, & F of sheet "Labor Costing" respectively, starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me know.

Any help would be appreciated,

TIA,
Todd





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Trouble with a macro - copying cells

Hi Bob,

Thanks for your reply. This code works except that it only
works for the first row that it finds "PKG". I need it to
look at ALL rows for "PKG" in column M and then run your
code for each row that it finds "PKG".

Thanks again
-----Original Message-----
Slight type

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor
Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor
Costing").Range("C24")
Range("L" & oCell.Row).Copy Worksheets("Labor
Costing").Range("F24")
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote

in message
...
Not tested, but try this

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor

Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor

Costing").Range("C24")
Range("L & oCell.Row).Copy Worksheets("Labor

Costing").Range("F24")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing

direct)

"ToddG" wrote in

message
...
Having trouble coming up with a macro to do the

following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to

cells
A, C, & F of sheet "Labor Costing" respectively,

starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me

know.

Any help would be appreciated,

TIA,
Todd





.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Trouble with a macro - copying cells

Thanks very much for the link Frank...Great page. I'll
take a look at it.

Thanks again,
Todd
-----Original Message-----
Hi
as a starting point:
http://www.rondebruin.nl/copy5.htm

--
Regards
Frank Kabel
Frankfurt, Germany


ToddG wrote:
Having trouble coming up with a macro to do the

following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to cells
A, C, & F of sheet "Labor Costing" respectively,

starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me

know.

Any help would be appreciated,

TIA,
Todd

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Trouble with a macro - copying cells

Dim iRow As Long

Sub CopyData()
Dim oCell As Range, sFirst

iRow = 24
With Columns("A:A")
Set oCell = .Find("PKG")
If Not oCell Is Nothing Then
sFirst = oCell.Address
Do
CopyCells oCell
Set oCell = .FindNext(oCell)
Loop While Not oCell Is Nothing And _
oCell.Address < sFirst
End If
End With

End Sub

Sub CopyCells(rng As Range)

Range("A" & rng.Row).Copy _
Worksheets("Labor Costing").Range("A" & iRow)
Range("B" & rng.Row).Copy _
Worksheets("Labor Costing").Range("C" & iRow)
Range("L" & rng.Row).Copy _
Worksheets("Labor Costing").Range("F" & iRow)

iRow = iRow + 1

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ToddG" wrote in message
...
Hi Bob,

Thanks for your reply. This code works except that it only
works for the first row that it finds "PKG". I need it to
look at ALL rows for "PKG" in column M and then run your
code for each row that it finds "PKG".

Thanks again
-----Original Message-----
Slight type

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor
Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor
Costing").Range("C24")
Range("L" & oCell.Row).Copy Worksheets("Labor
Costing").Range("F24")
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote

in message
...
Not tested, but try this

Set oCell = Columns("A:A").Find("PKG")
If Not oCell Is Nothing Then
Range("A" & oCell.Row).Copy Worksheets("Labor

Costing").Range("A24")
Range("B" & oCell.Row).Copy Worksheets("Labor

Costing").Range("C24")
Range("L & oCell.Row).Copy Worksheets("Labor

Costing").Range("F24")
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing

direct)

"ToddG" wrote in

message
...
Having trouble coming up with a macro to do the

following:

If any cell in column A of sheet "Export" = "PKG",
Copy the cells in columns A, B, & L in that row to

cells
A, C, & F of sheet "Labor Costing" respectively,

starting
at Row 24 (of sheet "Labor Costing").

Kind of hard to explain, if you need more info let me

know.

Any help would be appreciated,

TIA,
Todd




.



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
trouble copying a formula naj Excel Discussion (Misc queries) 4 May 27th 09 12:16 PM
Trouble copying graphs galatea2153 Excel Discussion (Misc queries) 2 October 15th 07 01:58 AM
Copying cells with a macro MAWII Excel Discussion (Misc queries) 1 April 18th 05 06:50 PM
Trouble copying and pasting a formula Julie P. Excel Worksheet Functions 4 March 3rd 05 03:16 AM
Macro trouble finding 'empty' cells foamfollower Excel Programming 1 October 1st 03 02:59 AM


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