Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I get items from sheet 3 to show up on sheet 1 and 2? | Excel Worksheet Functions | |||
How do you copy items from many worksheets to one? | Excel Discussion (Misc queries) | |||
copy items | Excel Discussion (Misc queries) | |||
how do I set up time sheet and items bought expense sheet | Excel Discussion (Misc queries) | |||
Copy last 13 items | Excel Programming |