+ Reply to Thread
Results 1 to 1 of 1

clear contents of cells after rows that gets autofilled based on col rowcount

Hybrid View

Luer clear contents of cells after... 07-20-2010, 12:30 PM
  1. #1
    Registered User
    Join Date
    07-20-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2002
    Posts
    1

    clear contents of cells after rows that gets autofilled based on col rowcount

    Hi
    I am Using the following macro code to fill down a formula in "Sheet2" for a certain number of rows. The certain number of rows is based on the number of rows in "Sheet1" column A.


    Sub update()
    
    Dim lStop As Long
    
    With Worksheets("Sheet1")
      lStop = .Cells(.Rows.Count, "A").End(xlUp).Row
    
    End With
    Worksheets("Sheet2").Range("4:" & lStop).FillDown
    End Sub
    This works great except for when I delete a row in Sheet1. What happens then is that I get duplicates or errors at the buttom of Sheet 2. I was planning to solve this by adding to the existing macro a command that "clearcontents" of the cells after "lStop" in Sheet2. (Since the number of rows in "Istop" gets fewer when I delete a row in Sheet1 I am left with old formulas in bottom cells of Sheet2 which I want to clear)

    Any suggestions of how to do this?

    Best Regards
    Last edited by Luer; 07-20-2010 at 03:53 PM. Reason: Misstyping of sheetname

+ 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