+ Reply to Thread
Results 1 to 3 of 3

macro to select cells based on status of cells to left

Hybrid View

  1. #1
    Registered User
    Join Date
    02-27-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: macro to select cells based on status of cells to left

    Without seeing your data its hard to say.

    You could in VBA write a script that could loop through your cells and when it comes across a cell that matches your criteria it can CALL your other macro.

    Don't know quite what you want but it would be something like this:

    (this is completed untested, I've just written this straight on here)

    Sub TestCells()
    
    Dim lastrow, x as long
    
    LastRow = sheet1.usedrange.row + sheet1.usedrange.rows.count -1
    For x = 1 to lastrow
     If sheet1.range("A" & x).value = "your criteria here" then
     Call "your other macro here"
     end if
    Next x
    Regards
    MrExcelPro

  2. #2
    Registered User
    Join Date
    03-03-2011
    Location
    Ammurica
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: macro to select cells based on status of cells to left

    I have included a screenshot to demonstrate how my data.

    and below is the macro I currently use.

    I need everything to be in the correct row with the appropriate account.

    Sub Combine()
    '
    ' combine Macro
    '
    ' Keyboard Shortcut: Ctrl+e
    '
        Dim J As Integer
    
        If Selection.Cells.Count > 1 Then
            For J = 2 To Selection.Cells.Count
                Selection.Cells(1).Value = _
                  Selection.Cells(1).Value & " " & _
                  Selection.Cells(J).Value
                Selection.Cells(J).Clear
            Next J
        End If
    End Sub
    Attached Images Attached Images

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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