Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    US
    Posts
    439
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Better Way to code this? (2003)

    Hey everyone,

    I recorded the following macro. Basically, I am placing an date in a field IF I update the data. This code is imbedded in the code I am using to update the data when a specific button is clicked.


    Sheets("Data").Select
    ActiveWindow.ScrollColumn = 6
    ActiveWindow.ScrollColumn = 54
    ActiveWindow.ScrollColumn = 94
    ActiveWindow.ScrollColumn = 142
    ActiveWindow.ScrollColumn = 188
    ActiveWindow.ScrollColumn = 229
    ActiveWindow.ScrollColumn = 244
    Range("IU1").Select
    ActiveCell.FormulaR1C1 = "=TODAY()"
    Range("A1").Select

    Thanks for the help,
    Brad

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

    Re: Better Way to code this? (2003)

    You don't need all those ScrollColumn instructions.
    You can avoid selecting the cell you want to change. All the code you pasted can be replaced with the single instruction

    Sheets("Data").Range("IU1").Formula = "=TODAY()"

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    US
    Posts
    439
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Better Way to code this? (2003)

    Hans,


    Much cleaner....

    Thanks,
    Brad

  4. #4
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Better Way to code this? (2003)

    This should do the trick.

    sheets("data").range("iu1").formula="=Today()"

Posting Permissions

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