+ Reply to Thread
Results 1 to 4 of 4

Find Max within range and add $15

Hybrid View

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Valparaiso, FL
    MS-Off Ver
    Excel 2013
    Posts
    73

    Find Max within range and add $15

    Hello Gurus!

    I am working with a small table that shows prices and the total. I am trying to write a macro to find the highest price in the column N range. I was able to do this but of course it finds the grand total. I've uploaded a sample sheet. I have two rows that have prices in column N. I need to find the highest one and add $15. Then I'd like the one that has the added $15 to be highlighted or bolded so I can tell which one has the fee included.

    I really appreciate any assistance. Thank you!!
    Attached Files Attached Files

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Find Max within range and add $15

    Try something like this...
    Sub FindMaxAndAddToIt()
    Const fee As Long = 15     '$15 will be added to the max amount in col. N
    Dim MaxTF As Double
    Dim r As Long, lr As Long
    Dim tfRng As Range
    lr = Cells(Rows.Count, "I").End(xlUp).Row
    Set tfRng = Range("N1:N" & lr)
    
    MaxTF = Application.Max(tfRng)
    If MaxTF <> 0 Then
       r = Application.Match(MaxTF, tfRng, 0)
       Cells(r, "N") = Cells(r, "N") + fee
       With Cells(r, "N")
          .Interior.Color = rgbYellow
          .Font.Bold = True
       End With
    End If
    End Sub
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    03-06-2014
    Location
    Valparaiso, FL
    MS-Off Ver
    Excel 2013
    Posts
    73

    Re: Find Max within range and add $15

    Outstanding solution! Thanks so much!! That's perfect

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Find Max within range and add $15

    You're welcome. Glad I could help.
    Thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find pairs of words in range, then find next pair
    By brent.fraser in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2014, 12:31 PM
  2. Code to find named range doesn't find the correct field range?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2012, 05:54 PM
  3. [SOLVED] Using range.find to find two specific values in two columns
    By mhrub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2012, 01:02 PM
  4. Range.Find to find column and place value in next available cell in one line
    By davegugg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2011, 10:41 AM
  5. find row no. of particular cell in a range and find last entry in that row
    By VishalGupta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2011, 01:29 AM
  6. Replies: 2
    Last Post: 01-26-2009, 07:59 PM
  7. find, meet condition, sum range, deduce, find next
    By pinstripe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-27-2007, 09:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1