Consulting

Results 1 to 2 of 2

Thread: Macro to auto copy a cell and paste it in a particular column

  1. #1

    Macro to auto copy a cell and paste it in a particular column

    Macro to auto copy a cell and paste it in a particular column in a particular sheet each time.
    Example: when it is 5am, the macro copies the value in cell k4 and pastes it in m1, then when it is 6am the macro copies the value in cell k4 and pastes it in m2, then when it is 7am the macro copies the value in cell k4 and pastes it in m3, and so on!

    Please help

  2. #2
    VBAX Mentor
    Joined
    Aug 2012
    Posts
    367
    Location
    Hi,

    your request is very cryptic, but it sounds like you need to turn a time value into a range reference.

    you can define a range reference ( a cell) as follows

    sub 1()
    
    dim lNum as long
    
       thisworkbook.worksheets("Sheet 1").range ("A"&lnum).value = somenumber
    
    end sub
    getting lNum will require that you read the time and convert it into an integer value. to do this, you can use
    lnum = hour(the time)
    where 'the time' is the time you are referencing. this will give you an integer between 1 and 23.

    This should get you going
    Werafa
    Remember: it is the second mouse that gets the cheese.....

Posting Permissions

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