Find a text value in a column then enter values below that text in same column

poey

New Member
Joined
May 26, 2011
Messages
6
Hi, long time lurker, first time poster... thanks for your patience with me.

I have a multiple sheet workbook.
In the workbook, each sheet in column A has the word Total in it.
The word Total is on a different row on each sheet.

I am trying to come up with a macro that will find the word Total on each sheet (whether it's on A34 or A96), then pull the value of column B below it.

IE: if the word "Total" is in A34, then A35 should be B35, A36 = B36 and so on.

Thanks in advance for any help you can provide. :biggrin:
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try

Code:
Sub Test2()
Dim ws As Worksheet, Found As Range
For Each ws In ActiveWorkbook.workshets
    With ws
        Set Found = .Columns("A").Find(what:="Total", LookIn:=xlValues, lookat:=xlWhole)
        If Not Found Is Nothing Then Found.Offset(1).Value = Found.Offset(, 1).Value
    End With
Next ws
End Sub
 
Upvote 0
Thanks so much for the speedy response!
This worked, but it brought over the cell adjacent to "Totals", not one below.


<TABLE style="WIDTH: 244pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=326 border=0><COLGROUP><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 95pt; mso-width-source: userset; mso-width-alt: 4644" width=127><COL style="WIDTH: 101pt; mso-width-source: userset; mso-width-alt: 4937" width=135><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 48pt; BORDER-BOTTOM: #d4d0c8; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" width=64 height=20>
Total
</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 95pt; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" width=127>
Agents:
</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 101pt; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right width=135>
2
</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" height=20>

</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">
Commitmnt/Callbk
</TD><TD class=xl3813 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right>
0:08
</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" height=20>

</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">
Misc-closed
</TD><TD class=xl3813 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right>
0:46
</TD></TR><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" height=20>

</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">
Total
</TD><TD class=xl3813 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right>
0:54
</TD></TR></TBODY></TABLE>

Trying to get Commitmnt/Callbk , Misc-closed and any other cells that have data to be below the Total.

Thanks again.
 
Upvote 0
Then perhaps

Code:
Sub Test2()
Dim ws As Worksheet, Found As Range
For Each ws In ActiveWorkbook.workshets
    With ws
        Set Found = .Columns("A").Find(what:="Total", LookIn:=xlValues, lookat:=xlWhole)
        If Not Found Is Nothing Then Found.Offset(1, 1).Value = Found.Offset(, 1).Value
    End With
Next ws
End Sub
 
Upvote 0
Closer... but this is now moving "Agents" down in column B overtyping what i'm trying to move to column A.

Heading home from work, thanks SO much for your help. Can't express my gratitude enough.

Laura
 
Upvote 0
try:
Code:
Sub blah()
For Each sht In ThisWorkbook.Sheets
  Set TotalRng = sht.Range("A:A").Find(what:="Total", LookIn:=xlValues, lookat:=xlWhole)
  If Not TotalRng Is Nothing Then
    'Stop 'F8 to step through code, F5 to continue.
    offst = 1
    Do Until TotalRng.Offset(offst, 1) = ""
      TotalRng.Offset(offst).Value = TotalRng.Offset(offst, 1).Value
      offst = offst + 1
    Loop
  End If
Next sht
End Sub
 
Upvote 0
Just thought maybe a none macro and also independent of text on the last row will be an interesting approach to get the result .... You can easily adjust the formula for sheet name reference.

I just wanted to see if it was possible to this without macro , that is all,


Excel Workbook
ABCDEFGHI
2JanFebMarAprMay
3MonthSales14512572197320132264
4Jan$22,160.0017922884130728222036
5Feb$23,787.0011492193191925422066
6Mar$ 9,276.0016432117119428032976
7Apr$27,182.0018352614178021112803
8May$42,224.0015522588110327612970
912742343$9,276.0027032605
101978224023742405
111483216120812300
121870207527512198
131688$23,787.0022212349
141367$27,182.002548
1518412821
1612372020
17$22,160.002897
182572
192394
20$42,224.00
Sheet3
 
Upvote 0
p45cal and snoopy, both of these worked!
Thank you SO VERY MUCH for your help!

VoG, you rock too!

Laura
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top