+ Reply to Thread
Results 1 to 4 of 4

need help with this script

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    need help with this script

    I have created a document and added a button with this macro script attached.
    currently this works great and does exactly what i wanted it to do but I am having trouble changing it. Thank you Dflak and DannyJ for helping me get to here.
    Right now it creates the time stamps in column A. I need to be able to change it to write the results in another column. This will allow me to create more buttons and have each post to a different column. I have tried everything i know and can not make it work. Any help would be apreciated.


    Sub InputTime()

    Dim emptyRow As Long 'emptyRow is used instead of a row number

    emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1 'Defines empty row as first empty row in a column (In this case Column A)

    Sheets("Sheet1").Cells(emptyRow, 1).Value = Now()


    Sheets("Sheet1").Cells(emptyRow, 1).NumberFormat = "h:mm:ss;@"



    End Sub
    Last edited by chriswrcg; 10-12-2016 at 11:11 AM.

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: need help with this script

    Could you be more specfic? please include a sample of what you desire.

  3. #3
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: need help with this script

    Change the colored number to the desired No. of column

    Sheets("Sheet1").Cells(emptyRow, 1).Value = Now()


    Sheets("Sheet1").Cells(emptyRow, 1).NumberFormat = "h:mm:ss;@"
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  4. #4
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: need help with this script

    yes,
    Right now there is a button on the sheet
    every time you click it it displays the time. The first time in A1, then A2, then A3,A4,A5 and so on. each time you click it, the time is displayed in the cell just under the last cell that the time was displayed.
    What I want to do is be able to have button one populate column a, button 2 to populate column c or whatever.

    The best way to do this is to copy each button but modify the code and change where the information will be displayed. I have tried modifing the above code every way I can think of but all I am getting is an error message. I need help changing the code so that I can easily change were the information is populated.

    see the attached file.
    Attached Files Attached Files

+ 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. script to run the macro from Vb script with out opening the excel file
    By chandanp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2021, 03:33 AM
  2. [SOLVED] Need script to change script within script
    By kjsconv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2016, 07:51 AM
  3. Execute VB Script/ SAP Script from Excel
    By ramkrishna1111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2015, 01:54 PM
  4. calling the vb script from the shell script(unix platform)
    By chandanp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2014, 06:21 AM
  5. Integrating Mainframe emulator script with excel's vba script
    By Himanshu Mishra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2012, 10:30 AM
  6. Create VBA script to short, dedicated button in excel for script?
    By realized in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2009, 11:54 PM
  7. Script that edits the text printed on the button that runs the script
    By petalred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2008, 02:41 PM

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