Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Autofill (Excel 2002)

    I have the following code in a macro that works correctly, however I need to make it stay as text or something as when it autofills it adds a number to it... for example the data in range A2 is JAN07, and when it is autofilled by the macro, cell B2 says FEB07, C2 says MAR07, etc. Likewise in cell B2 I have the financial division, which is 04, then when it is autofilled cell B3 is 05, cell B4 is 06, etc. I really just want all the cells to stay at the JAN07 and the 04. I've formatted the cells in Excel to text and it didn't work. Any ideas???
    Thanks!!
    Lana

    Dim x As Long

    Range("C65536").Select
    x = -Range(Selection, Selection.End(xlUp)).Rows.Count + 65537

    Range("A2:B2").Select
    Selection.AutoFill Destination:=Range("A2:B" & x)

    Range("F2:G2").Select
    Selection.AutoFill Destination:=Range("F2:G" & x)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Autofill (Excel 2002)

    I'd use FillDown instead of AutoFill for those columns that shouldn't change:

    Range("A2:B" & x).FillDown

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Autofill (Excel 2002)

    Awesome... thanks Hans!
    Lana

Posting Permissions

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