+ Reply to Thread
Results 1 to 1 of 1

Improving an existing macro to autofill all columns, not just column A

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Norfolk, England
    MS-Off Ver
    Excel 2002
    Posts
    1

    Post Improving an existing macro to autofill all columns, not just column A

    Hello, hopefully this is a quick and easy question

    Please could somebody advise how I can adjust the following macro to autofill a range of columns, not just column A? I have tried simple changes like "a1:w1" without any success. Obviously changing the Range individually works (to b1 etc) but that is tedious. We are using excel 2002. Any help would be much appreciated!

    Sub fill()
    Range("a1").Select
    Do Until ActiveCell.Value = "stop"
    If ActiveCell.Value <> "" Then
    Dim a As String
    a = ActiveCell.Address
    ActiveCell.Offset(1, 0).Activate
    Count = 1
    End If
    Do Until ActiveCell.Value <> ""
    If ActiveCell.Value = "" Then
    ActiveCell.Offset(1, 0).Activate
    Count = Count + 1
    End If
    Loop
    Dim b As String
    ActiveCell.Offset(-1, 0).Activate
    b = ActiveCell.Address
    Range(a & ":" & b).FillDown
    ActiveCell.Offset(1, 0).Activate
    Loop
    '

    This macro basically autofills cells downwards in a column until it meets another full cell, where it copies that down to the next full cell, and so on.

    Thanks in advance

    Mark
    Last edited by ExcelQuery; 05-25-2011 at 10:05 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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