Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Autofill???

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I don't know how to do this but I want to add this to a macro.

    In cell a1 there is a date (the rest of the column is blank) and in the column next to it, column b, there is text, about 200 rows.

    How would I get the date to automatically fill in the cells, when there is text to the right of it?

    Thanks

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following code:

    Range("a1").Select
    Selection.AutoFill Destination:=Range("b1:b200").Offset(0, -1)

    Change ("b1:b200") to whatever the range is in column B. This will work if the column always the same size.


    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the advice, but what if the range changes.

  4. #4
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can find the used range in column B. Try the following code:

    ColumnBRange = Intersect(ActiveSheet.UsedRange, Columns("B")).Address
    Range("a1").Select
    Selection.AutoFill Destination:=Range(ColumnBRange).Offset(0, -1), Type:=xlFillCopy





    _________________
    Hope this helps.
    Kind regards, Al.

    [ This Message was edited by: Al Chara on 2002-04-01 13:33 ]

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well it kinda worked. It did what it was suppose to but the date changed, from 1/1 to 1/2 to 1/3 etc.

    Any ideas how to keep it the same?

    Thanks

  6. #6
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the code above, I edited it to suit your needs.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Location
    Los Angeles, CA
    Posts
    752
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the help it worked great.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •