+ Reply to Thread
Results 1 to 2 of 2

How to create a routine

  1. #1
    Tara
    Guest

    How to create a routine

    I would like to have a routine that would put data (an X) in cells at the
    start of a day, so that as I then check the item each day and update the
    contents of other cells, I can remove the X? It would only do this at the
    start of a new day. The worksheet might be opened several different times.

  2. #2
    Dave Peterson
    Guest

    Re: How to create a routine

    I bet you could do something like this. But what happens when you get
    interrupted and have to start over. If your routine actually keeps track, you
    may not be able to reset your data.

    How about an alternative. Just have a macro that you can run on demand. Run it
    whenever you want (usually the first time you open the workbook that day).

    Say your X's go in column A starting in Row 2 and continues until you run out of
    data in column B.

    You could use something like:

    Option Explicit
    Sub AddXs()

    Dim wks As Worksheet
    Dim FirstRow As Long
    Dim LastRow As Long

    Set wks = Worksheets("Sheet1")

    With wks
    FirstRow = 2
    LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row

    .Range(.Cells(FirstRow, "A"), .Cells(LastRow, "A")).Value = "X"
    End With

    End Sub

    Then you could run it by:
    tools|macro|macros|select the name of the macro (AddXs)
    click run



    Tara wrote:
    >
    > I would like to have a routine that would put data (an X) in cells at the
    > start of a day, so that as I then check the item each day and update the
    > contents of other cells, I can remove the X? It would only do this at the
    > start of a new day. The worksheet might be opened several different times.


    --

    Dave Peterson

+ 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