LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default VB Code Help - locate and sum

Via VB code, I'm attempting to locate the row that has the word 'Total' in it
(A4)which will always be in coumn A and then move to the same row in colum B
(B4) and sum that data from the row above the active cell to the top of the
column sum(B3:B1).

Column A Column B
Row1 Test1 45
Row2 Test2 51
Row3 Test3 39
Row4 Total

Here is the code I've written although it doesn't work since the word
'Total' will appear in a different row each time. Any suggestions on how to
locate the word 'Total' then move to the immediate right and sum up the data
above it?

Cells(1, 1).Select
Set rng = Range("A1:IV65400").Find(What:="Total", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

Range(rng, rng.End(xlToRight)).Offset(0, 1).Select
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=SUM(R[-42]C:R[-1]C)"

 
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
Locate Duplicates Gary Excel Worksheet Functions 3 December 29th 06 10:48 PM
locate query jenn Excel Discussion (Misc queries) 0 January 20th 06 12:18 AM
VBA code to locate cell address of AutoFilter dropdown box Dennis Excel Discussion (Misc queries) 3 August 9th 05 10:00 PM
Cannot locate icons ?? Koko New Users to Excel 3 August 3rd 05 08:52 AM
How can I locate the second to last value in a range? A shink Excel Worksheet Functions 5 June 4th 05 01:17 AM


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