LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default When found add it to the last and display total in Msgbox


I am looking in column A of the sheets for a name and each name will have a value next to it in B. The name may appear multiple times per sheet,
so find next or all is necessary for a total across all sheets.

Assume In code below all is Dimmed correctly, how to add all the varOut's as they are found in column A .Offset(, 1) of each sheet in array.

Can the same code lines be used for constants and values from formulas or is a PasteSpecial.Values needed?

Once I have the correct code lines to add the varOut's I assume I can also use that code with FIND as the search method also?

Not stuck on this code if it can be quicker or more efficient.

Thanks.
Howard


MyArr = Array("Sheet2", "Sheet3", "Sheet4")

For i = LBound(MyArr) To UBound(MyArr)

With Sheets(MyArr(i))
lr = .Cells(.Rows.Count, 1).End(xlUp).Row
Set rngA = .Range("A1:A" & lr)

For Each c In rngA
If c = myName Then
varOut = c.Offset(, 1)

'/ add all the varOut's
'/ together as they are found
'/ across all the sheets
'/ and display total in msgbox

End If
Next 'c

End With
Next 'i

MsgBox "The total for " & myName & " is: " & varOut
 
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
MsgBox to display [hh]:mm learner Excel Programming 6 October 24th 09 04:03 PM
Making a msgbox return a value in one cell, when data is searched and found in another. TIA JasonK[_3_] Excel Programming 4 July 4th 09 05:59 PM
Running total of Found Substrings in MainString in Big Loop ExcelMonkey Excel Programming 1 January 17th 08 06:52 PM
How to display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
If no FIND value is found, then a Msgbox to say so and exit sub L. Howard Kittle[_2_] Excel Programming 3 September 23rd 03 08:46 PM


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