+ Reply to Thread
Results 1 to 5 of 5

If last cell in column A is Greater than column B Then Offset Column A

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    If last cell in column A is Greater than column B Then Offset Column A

    Hi Again,

    I have a spreadsheet that does a lot of offsetting and removing if certain criteria is not met and I have a summary macro that runs along the bottom of the spreadsheet.

    The issue I am having is that the summary should offset by two rows to the last cell of column D or column G dependent on which is the lowest cell row in mentioned columns.

    For example if the last cell in column G is in a lower row than the last cell in Column D then offset the summary of Column G and vice versa.

    I have looked around but I can't seem to find anything so I can't supply a starting code, sorry.

    Does anyone have a suggestion?

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: If last cell in column A is Greater than column B Then Offset Column A

    A sample workbook is the best option here, can you provide a copy

  3. #3
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: If last cell in column A is Greater than column B Then Offset Column A

    Hi nigelog,

    Unfortunately I can't as it is a huge workbook and has a lot of confidential information. I can supply screenshots of the different scenarios though?

  4. #4
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: If last cell in column A is Greater than column B Then Offset Column A

    Does this help?

    Special Instruction Summary should offset from column D

    Capture1.JPG

    Special Instruction Summary should offset from column G

    Capture2.JPG

  5. #5
    Forum Contributor
    Join Date
    06-30-2014
    Location
    London, England
    MS-Off Ver
    365 & 2010
    Posts
    100

    Re: If last cell in column A is Greater than column B Then Offset Column A

    Hi,

    I think I have found the solution from Ron de Bruin if anyone is interested

    Sub LastRow_Example()
        Dim LastRow As Long
        Dim rng As Range
    
        ' Use all cells on the sheet
        Set rng = Sheets("Sheet1").Cells
    
        'Use a range on the sheet
        'Set rng = Sheets("Sheet1").Range("A1:D30")
    
        ' Find the last row
        LastRow = Last(1, rng)
    
        ' After the last row with data change the value of the cell in Column A
        rng.Parent.Cells(LastRow + 1, 1).Value = "Hi there"
    
    End Sub
    Function Last(choice As Long, rng As Range)
    
        Dim lrw As Long
        Dim lcol As Long
    
        Select Case choice
    
            On Error Resume Next
            Last = rng.Find(What:="*", _
                            After:=rng.Cells(1), _
                            Lookat:=xlPart, _
                            LookIn:=xlFormulas, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlPrevious, _
                            MatchCase:=False).Row
            On Error GoTo 0
    
    End Select
    End Function
    https://www.rondebruin.nl/win/s9/win005.htm

+ 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. Count Unique items in one column if values in other column is greater than zero
    By SanjivManiktala in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-24-2018, 02:52 PM
  2. [SOLVED] Conditional formula IF column X is greater than Zero than column P highlights cell
    By rz6657 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-24-2016, 11:00 AM
  3. Replies: 0
    Last Post: 01-29-2013, 01:46 PM
  4. [SOLVED] Trying to count cells greater than # in one column if another column meets criteria
    By lorne17 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-14-2012, 07:01 PM
  5. [SOLVED] Delete Cell Numbers of Column B From Column A (Column B Small and Column A too big)
    By it_electronics2000 in forum Excel General
    Replies: 5
    Last Post: 04-06-2012, 12:02 PM
  6. [SOLVED] Delete Cell Numbers of Column B From Column A (Column B Small and Column A too big)
    By it_electronics2000 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-06-2012, 11:19 AM
  7. [SOLVED] Delete Cell Numbers of Column B From Column A (Column B Small and Column A too big)
    By it_electronics2000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-06-2012, 11:13 AM

Tags for this Thread

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