+ Reply to Thread
Results 1 to 3 of 3

macro to select cells based on status of cells to left

Hybrid View

dcbiker macro to select cells based... 03-03-2011, 03:49 PM
MrExcelPro Re: macro to select cells... 03-03-2011, 04:37 PM
dcbiker Re: macro to select cells... 03-03-2011, 05:15 PM
  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    Ammurica
    MS-Off Ver
    Excel 2007
    Posts
    2

    macro to select cells based on status of cells to left

    Hi guys, sorry if my title doesn't clearly explain my problem, I'll try and do a better job here.

    I have several spreadsheets that are several thousand rows each and they all have the same problem.

    I copy and pasted the data from a website into a txt document and imported it into excel and I have the following problem.

    Title | Description | Features
    | Description | Features
    | Description | Features
    Title | Description | Features
    | Description | Features

    I need to get all of that information into 1 row for each title. I have a macro that allows me to manually select the relevant rows and it then combines them but since I have thousands of lines this is no longer practical.

    How can I have a macro that selects a cell if the cell under title in the same row is blank and the automatically sends that through my other macro.

    Thanks in advance for the help.

  2. #2
    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

  3. #3
    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