+ Reply to Thread
Results 1 to 16 of 16

How use =now function and how to retrieve data from another shee?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    How use =now function and how to retrieve data from another shee?

    I've searched through various threads and need two quick questions answered please

    1. I need users of the worksheet to be able to hit a button(marco) and add the contents of say A1 to A2, and have A1 be totally clear after that. I also need them to only be able to do this after the work day, say 5. I know this is done with the now function but haven't got it yet

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    First part.

    Range("A2") = Range("A1")
    Range("A1").ClearContents
    or
    Worksheets("Sheet1").Range("A2") = Worksheets("Sheet1").Range("A1")
    Worksheets("Sheet1").Range("A1").ClearContents


    Second part, what do you mean by work day 5.

    Mangesh

  3. #3
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    Sorry for the confusion

    Thanks for the reply. I work for an energy trading company and am making a position tracker. At midnight, or 0:00 Eastern Time, I need the contents of one cell to be summed with the contents of another. Example

    Yesterday Today after the "rollover" or summation fo the two cells they would
    (200) A 100 look like this. So when the clock hits midnight, it will show this:
    100 B 400

    Yesterday Today A and B are just different contracts, those rows are entirely
    (100) A 0 independent of one another. I just need to be able to hit a
    500 B 0 or marco or "button" on the spreadsheet for the traders so when they come in in the morning they can rollover their positions and have the today column clear to track the trades they will do for the new day. I hope that makes sense. Thanks for the hep!

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    I am sorry, I could not understand, but if you want the above macro to work only after 5 pm, then use:

    Private Sub CommandButton1_Click()

    If Time > TimeValue("17:00:00") And Worksheets("Sheet1").Range("A1") <> "" Then

    Worksheets("Sheet1").Range("A2") = Worksheets("Sheet1").Range("A1")
    Worksheets("Sheet1").Range("A1").ClearContents

    End If

    End Sub


    Mangesh

  5. #5
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40
    thanks for the reply. I posted that code in vb, now how to I assign it to a macro. I've already got the button on the sheet. When I right click and select assign macro I select it but it comes up with the macro cannot be found

  6. #6
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    Better Example

    I attached the file so it will make more sense. Basically what I need is a macro that by clicking it will sum cell C12 and F12 placing the sum in F12, C13 and F13 placing the sum in F13, and so on. We just need yesterdays volume to be combined with todays in each row. Each row basically represents a different product. The time requirement isn't an issue. Instead I would like a message to pop up when the macro is hit to ask "are they sure they want to rollover" Then by click yes or no it will do so accordingly. Thanks for all the help!
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    conditional question

    Second question for you is a conditional based calculation I believe. An example is attached. I know its probably easy but again I haven't got it yet, Thanks!
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Hi Dstock,

    many people here do not open attachments for the fear of viruses. So it would be better if you could explain your query in the post.

    Mangesh

  9. #9
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    granted

    Agreed. Only problem is when I copy and paste the formatting gets messed up sometimes. I will post add an attachment for those whose don't want to open an attachment. I got the conditional worked out. Mangesh thanks for all your help. More questions later today. Its probably bedtime over there

  10. #10
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    not yet. just 5:30 pm.

    Mangesh


    Agreed. Only problem is when I copy and paste the formatting gets messed up sometimes. I will post add an attachment for those whose don't want to open an attachment. I got the conditional worked out. Mangesh thanks for all your help. More questions later today. Its probably bedtime over there

  11. #11
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40
    My second question, which I don't believe is possible, is it possible to only hide/unhide and certain second of the block of cells. For example, if you have a 10X10 are you are working with, can I choose to hide/unide say the middle3X3. I don't believe this is possible because it HAS to assign rows and columns for everything. Thanks!
    Edit/Delete Message

    That rollover function worked. I will be working on it more today and probably post something tomorrow. Thanks.

  12. #12
    Registered User
    Join Date
    06-12-2005
    MS-Off Ver
    Office 2016
    Posts
    40

    Third question

    So I have grouped cells, but was wondering if it is possible for them to pop up in stead of down. When I click + they always collapse down, is there a way to have them collapse up instead?

+ 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