+ Reply to Thread
Results 1 to 3 of 3

Macro/VBA to query clock before placing value in relevant cell.

  1. #1
    Registered User
    Join Date
    12-23-2021
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    2

    Macro/VBA to query clock before placing value in relevant cell.

    Hi all,

    This is my first post and may be a bit if a strange one. I have worked in education for a long time now and some time ago I created a fairly complex spreadsheet to monitor, track and report on pupil progress linked to specific criteria. The process has been designed to make the relevant data entry pretty much fool proof, leading to realistic analytical outcomes. I am now in my 8th version of this spreadsheet and am looking to make it even easier from the end user perspective. However, I'm not even sure if what I want to achieve is even possible, so any suggestions would be amazing.

    I would like to know if is it possible for a macro/VBA to query real time and place a numeric entry in to appropriate cell? At the moment, when a user presses a specific Excel button a macro is activated which puts a numeric value in a specified cell (EG cell A1). If the button is pressed again, the value in that cell increases by 1. So far this is a relatively simple click counter process. What I would like to achieve is that when the button is pressed a macro/VBA code would then query the clock for current time and based on the reported time to place the value in one of a range of cells. For example: If the button is pressed at 13:00 the value is placed in cell A1, however, the same button, when pressed at 13:15 would place the value in cell B1.

    I am by no means an Excel expert, but am familiar with general functions, formulas, macros and codes. However the answer to this particular problem eludes me! If anyone has a suggestion, or is even able to confirm if this is even possible, I would be eternally grateful!

    Thanks in advance!
    Last edited by RoyGee; 12-23-2021 at 01:04 PM.

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,460

    Re: Macro/VBA to query clock before placing value in relevant cell.

    Please Login or Register  to view this content.
    it depends what kind of button you choose.
    The "me.cells(..." has to modify in "Activesheet.cells(..." or "sheets("Name of the sheet").cells(...."
    Attached Files Attached Files
    Last edited by bsalv; 12-23-2021 at 12:56 PM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    12-23-2021
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Macro/VBA to query clock before placing value in relevant cell.

    Thank you bslav,

    This solution sounds like it could be modified to work with my sheet. I will have a go and let you know the outcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 16
    Last Post: 12-20-2017, 07:50 PM
  2. Looking For Relevant Power Query tutoral / guide
    By Tooley in forum Excel General
    Replies: 4
    Last Post: 12-07-2017, 02:02 PM
  3. [SOLVED] Stripping Keywords out of a text string and placing into relevant columns
    By seanpcorbett1 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-12-2016, 10:25 AM
  4. Macro to look up cell in table and paste relevant information.
    By jimbobakoo in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-19-2014, 10:06 AM
  5. Macro to Create and Rename Multiple Worksheet and then Placing Relevant Data.
    By ashokpatidar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2014, 04:30 PM
  6. Query against the system clock ?
    By duggie66 in forum Excel General
    Replies: 0
    Last Post: 01-23-2013, 04:30 PM
  7. placing a security protection on table, form, query or macro in MS Access
    By nataliem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2007, 09:40 PM

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