Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RJH RJH is offline
external usenet poster
 
Posts: 44
Default Copy 2 items to next sheet

Hello,
I have detailed orders listed on page 2. I would like to scan the page and
find each occurrence of the word "Total" (which is in column 'H'), once
finding that, I would like to copy each number associated with "Total"
(numbers are in 'I') and the order number associated with the order (2 rows
up and in column 'B'). I would then like to paste the 2 items side by side
to page 3 starting at A2. (Order # in A2, Total in B2).

The best code I could come up with would only copy a single occurrence of
the 'word' Total to page 3.

I appreciate your help!

Thanks!

Bob Howard


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Copy 2 items to next sheet

one way:

Public Sub TransferTotals()
Dim rFound As Range
Dim rDest As Range
Dim sFoundAddr As String

Set rDest = Sheets("Sheet3").Range("A2")
Set rFound = Columns(8).Find( _
What:="Total", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=xlFalse)
If Not rFound Is Nothing Then
sFoundAddr = rFound.Address
Do
rDest.Offset(0, 1).Value = rFound.Offset(0,1).Value
rDest.Value = _
rFound.Offset(-2, -6).Value
Set rFound = Columns(8).FindNext( _
After:=rFound)
Set rDest = rDest.Offset(1, 0)
Loop Until rFound.Address = sFoundAddr
End If
End Sub





Columns(8).FindNext(In article
,
"RJH" wrote:

Hello,
I have detailed orders listed on page 2. I would like to scan the page and
find each occurrence of the word "Total" (which is in column 'H'), once
finding that, I would like to copy each number associated with "Total"
(numbers are in 'I') and the order number associated with the order (2 rows
up and in column 'B'). I would then like to paste the 2 items side by side
to page 3 starting at A2. (Order # in A2, Total in B2).

The best code I could come up with would only copy a single occurrence of
the 'word' Total to page 3.

I appreciate your help!

Thanks!

Bob Howard


  #3   Report Post  
Posted to microsoft.public.excel.programming
RJH RJH is offline
external usenet poster
 
Posts: 44
Default Copy 2 items to next sheet

That worked great with only one hitch. I didn't explain my needs very well.
Sheet2 will be cleared from time to time and Sheet3 will continue on. I
need to post the totals from sheet2 to the last empty row on sheet3. I
tried working on your code to make it do this but, no luck. If you could
help again I would appreciate it.

Thanks!

Bob Howard

"JE McGimpsey" wrote in message
...
one way:

Public Sub TransferTotals()
Dim rFound As Range
Dim rDest As Range
Dim sFoundAddr As String

Set rDest = Sheets("Sheet3").Range("A2")
Set rFound = Columns(8).Find( _
What:="Total", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=xlFalse)
If Not rFound Is Nothing Then
sFoundAddr = rFound.Address
Do
rDest.Offset(0, 1).Value = rFound.Offset(0,1).Value
rDest.Value = _
rFound.Offset(-2, -6).Value
Set rFound = Columns(8).FindNext( _
After:=rFound)
Set rDest = rDest.Offset(1, 0)
Loop Until rFound.Address = sFoundAddr
End If
End Sub





Columns(8).FindNext(In article
,
"RJH" wrote:

Hello,
I have detailed orders listed on page 2. I would like to scan the page

and
find each occurrence of the word "Total" (which is in column 'H'), once
finding that, I would like to copy each number associated with "Total"
(numbers are in 'I') and the order number associated with the order (2

rows
up and in column 'B'). I would then like to paste the 2 items side by

side
to page 3 starting at A2. (Order # in A2, Total in B2).

The best code I could come up with would only copy a single occurrence

of
the 'word' Total to page 3.

I appreciate your help!

Thanks!

Bob Howard




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Copy 2 items to next sheet

One way:

Replace

Set rDest = Sheets("Sheet3").Range("A2")

with

Set rDest = Sheets("Sheet3").Range( _
"A" & Rows.Count).End(xlUp).Offset(1, 0)



In article
,
"RJH" wrote:

That worked great with only one hitch. I didn't explain my needs very well.
Sheet2 will be cleared from time to time and Sheet3 will continue on. I
need to post the totals from sheet2 to the last empty row on sheet3. I
tried working on your code to make it do this but, no luck. If you could

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
How do I get items from sheet 3 to show up on sheet 1 and 2? HeidiG Excel Worksheet Functions 1 October 30th 06 05:57 PM
How do you copy items from many worksheets to one? White49 Excel Discussion (Misc queries) 4 June 14th 06 10:22 PM
copy items gdg Excel Discussion (Misc queries) 1 February 7th 06 10:37 PM
how do I set up time sheet and items bought expense sheet gianni Excel Discussion (Misc queries) 1 December 24th 05 11:10 AM
Copy last 13 items Robert Gillard Excel Programming 0 September 3rd 03 01:36 AM


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