Results 1 to 6 of 6

Last Column count based on find.row count

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Last Column count based on find.row count

    I'm not sure how to colour the line but the "LastNumba" line of code is causing me some grief. I've tried to replicate the Rownumba format but I can't quite get it right. Can anyone help me work out how to find the last cell with a value in it using the row found in row number, and then allow me to use it as ColRef so I can paste a value into the result?

    Dim RowNumba As Long, LastNumba As Long
    Dim CellRef As Range, ColRef as Range
    Dim S2LI As Worksheet
        
        Set S2LI = ThisWorkbook.Sheets(2) ' Set the worksheet, Change to suit
    '   Change the (2) below to the column number your searching (2 = B:B)
        RowNumba = S2LI.Columns(2).Find(What:=SearchString, LookIn:=xlValues, LookAt:=xlPart, _
            SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Row
    
        LastNumba = S2LI.Cells(rownumber, Columns.count).End(xlToLeft)
        
    ' Change the column number to suit
    
        Set ColRef = S2LI.Cells(RowNumba, LastNumba)
        Set CellRef = S2LI.Cells(RowNumba, 86)
    
                If Letters.Browse.Text <> "" And Letters.Description.Text <> "Templates" And CellRef.Value = "" Then
                    On Error Resume Next
                        CellRef.Value = Letters.Browse.Value
                        CellRef.Offset(0, 1).Value = Letters.Description.Value
                    On Error GoTo 0
    
                ElseIf Letters.Browse.Text <> "Templates" And Letters.Description.Text <> "" And CellRef.Value <> "" Then
                    On Error Resume Next            
                        ColRef.Offset(0, 1).Value = Letters.Browse.Value
                            ColRef.Offset(0, 2).Value = Letters.Description.Value
                    On Error GoTo 0
    Last edited by Sc0tt1e; 03-23-2014 at 10:17 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] To find the count based on data and criteria.
    By raovv in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-11-2013, 02:35 AM
  2. [SOLVED] count strings based on dates if find duplicate consider it one
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-10-2012, 01:06 AM
  3. [SOLVED] Count Rows Based On User Input & Trigger Print Of Pages Out Of Count Result
    By wliang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2012, 02:45 AM
  4. function to find out count based on criteria.
    By arnab0711 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2011, 06:45 AM
  5. How do i count numbers and letters to find a total count of all
    By Linda in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-10-2005, 12:55 PM

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