Posts by ssnch

    Hi, I'm relatively new to using VBA and am having a similar problem. I want to select a range of cells and merge it but I am getting the Runtime error 1004 as well. here's my code:

    Code
    Dim LastRow As Long, x As Integer, y As Integer
        
    mtSH.Select
    LastRow = Range("AF" & Rows.Count).End(xlUp).Row
        x = LastRow + 2
    Range("P" & x).Offset(0, 2).Select
    y = ActiveCell.Row
    Range("S" & y).Select
    Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(0, 5)).Merge
    ActiveCell.Select

    Re: count and trim words


    Thanks Ger Plante, I checked out the link but it's not exactly what I'm looking for.

    I wrote the following function but it's not quite working out

    Not sure what is the best formula to use for the following scenario:

    Sample: Cell A1 contains 1000 words and some are followed by an comma (red apples, oranges, yellow spotted bananas, etc).

    I need a formula in cell B1 that will copy the first 1024 characters rounding down to the last full word left of the comma. Another formula in cell B2 that will continue from the next word right of the comma where cell B1 left off and copy the next 1024 characters rounding down to the last full word left of the comma. Repeat in cell B3 except it will continue from the next word right of the comma where cell B2 left off and copy the next 1024 characters rounding down to the last full word left of the comma. Etc., etc., etc.

    Any help would be appreciated sorry if I didn't express my dilemma properly, I can provide more clarification if needed.