+ Reply to Thread
Results 1 to 5 of 5

Every 4th cell is blank and stops my macro!

  1. #1
    Registered User
    Join Date
    03-14-2006
    Posts
    23

    Every 4th cell is blank and stops my macro!

    I am trying to run the following Macro and I'm not having any trouble except every 4th row in the dataset is blank, causing this macro to stop dead in its tracks. What can I do to delete every 4th row and move the data up?

    Thanks particularly to Tom O. who has been a great help this week.

    Dim rng As Range
    With Worksheets("Sheet1")
    Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
    End With
    With Worksheets("Sheet2")
    .Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    End With
    Last edited by Sandeman; 03-17-2006 at 11:34 AM.

  2. #2
    Registered User
    Join Date
    03-14-2006
    Posts
    23
    Nevermind. I think I figured this out. Google is your friend!

  3. #3
    Don Guillett
    Guest

    Re: Every 4th cell is blank and stops my macro!

    try
    >Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))

    Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlup))


    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Sandeman" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I am trying to run the following Macro and I'm not having any trouble
    > except every 4th row in the dataset is blank, causing this macro to
    > stop dead in its tracks. What can I do to add "filler" data in every
    > 4th row for the length of the dataset or perhaps delete every 4th row
    > and move the data up?
    >
    > Thanks particularly to Tom O. who has been a great help this week.
    >
    > Dim rng As Range
    > With Worksheets("Sheet1")
    > Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
    > End With
    > With Worksheets("Sheet2")
    > Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    > End With
    >
    >
    > --
    > Sandeman
    > ------------------------------------------------------------------------
    > Sandeman's Profile:
    > http://www.excelforum.com/member.php...o&userid=32440
    > View this thread: http://www.excelforum.com/showthread...hreadid=523586
    >




  4. #4
    Ardus Petus
    Guest

    Re: Every 4th cell is blank and stops my macro!

    Dim rng As Range
    With Worksheets("Sheet1")

    Set rng = .Range(.Cells(2, 1), .Cells(Rows.Count 1).End(xlUp))

    End With
    With Worksheets("Sheet2")
    Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    End With

    HTH
    --
    AP

    "Sandeman" <[email protected]> a écrit
    dans le message de
    news:[email protected]...
    >
    > I am trying to run the following Macro and I'm not having any trouble
    > except every 4th row in the dataset is blank, causing this macro to
    > stop dead in its tracks. What can I do to add "filler" data in every
    > 4th row for the length of the dataset or perhaps delete every 4th row
    > and move the data up?
    >
    > Thanks particularly to Tom O. who has been a great help this week.
    >
    > Dim rng As Range
    > With Worksheets("Sheet1")
    > Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
    > End With
    > With Worksheets("Sheet2")
    > Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    > End With
    >
    >
    > --
    > Sandeman
    > ------------------------------------------------------------------------
    > Sandeman's Profile:

    http://www.excelforum.com/member.php...o&userid=32440
    > View this thread: http://www.excelforum.com/showthread...hreadid=523586
    >




  5. #5
    Tom Ogilvy
    Guest

    RE: Every 4th cell is blank and stops my macro!

    Dim rng As Range
    With Worksheets("Sheet1")
    Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
    End With
    With Worksheets("Sheet2")
    ..Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    End With

    or if you want to delete the rows

    Dim rng As Range
    With Worksheets("Sheet1")
    Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
    rng.specialcells(xlblanks).Entirerow.Delete
    Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
    End With
    With Worksheets("Sheet2")
    ..Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    End With

    --
    Regards,
    Tom Ogilvy


    "Sandeman" wrote:

    >
    > I am trying to run the following Macro and I'm not having any trouble
    > except every 4th row in the dataset is blank, causing this macro to
    > stop dead in its tracks. What can I do to add "filler" data in every
    > 4th row for the length of the dataset or perhaps delete every 4th row
    > and move the data up?
    >
    > Thanks particularly to Tom O. who has been a great help this week.
    >
    > Dim rng As Range
    > With Worksheets("Sheet1")
    > Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
    > End With
    > With Worksheets("Sheet2")
    > .Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
    > End With
    >
    >
    > --
    > Sandeman
    > ------------------------------------------------------------------------
    > Sandeman's Profile: http://www.excelforum.com/member.php...o&userid=32440
    > View this thread: http://www.excelforum.com/showthread...hreadid=523586
    >
    >


+ 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