Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel General
VBA Question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="h2so4, post: 7418730"] PeCoNe submitted this idea : hierbij aangepaste code. Sub alert() Dim i As Integer ' current row Dim cs As String ' stock name on current row Dim ps As String ' stock name we are busy with Dim sump As Double ' sum of col B for one code Dim frs As Integer ' address of first row with stock name dim factor as double Factor = Range("AA6") ' this macro assumes that all lines with the same code do follow each ' other i = 7 : 'first line with stock info With Worksheets("sheet1") cs = .range("F" & i) : 'stock code is i colum F ' loop thru all rows While cs <> "" sump = 0 frs = i ps = cs While ps = cs ' lets compute the sum of all the rows with the same code sump = sump + .Range("B" & i) i = i + 1 cs = .range("F" & i) Wend ' sump contains the sum of value of col B for a specific code sump=round(sump,2) ' trigger the alert based on your algorithm ' factor needs to de defined If sump > 0 And (IsEmpty(Range("AA" & frs)) Or _ Factor * sump > Range("AA" & frs)) Then Range("AA" & frs) = Factor * sump End If If Range("AA" & frs) > 0 And sump < Range("AA" & frs) Then Beep End If Wend End With End Sub [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel General
VBA Question
Top