+ Reply to Thread
Results 1 to 10 of 10

VBA Code to read value input on one sheet and update with that value on different sheet

  1. #1
    Registered User
    Join Date
    08-27-2018
    Location
    Naples, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    VBA Code to read value input on one sheet and update with that value on different sheet

    Absolute novice with Excel VBA.

    If I type in a value of "8" in a cell on a worksheet named "hours" and want that value (of 8) to update a specific cell on a worksheet named "updates" (and I have the row number and column number of the cell to be updated on the worksheet "updates"), what is the VBA code to accomplish this? Believe I need to pass three variables to a "routine" which are the target row number, column number and value.

    Would very much appreciate specific guidance on this.

    Thanks in advance!

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Hi and welcome.

    It's often easier for us to help if we can see the requirement in context. This is one of those times.

    Could you attach a sample workbook and demonstrate what you want your expected outcome to be?

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    BSB

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    The syntax would be like bellow but as BSB said, a sample workbook is neccessary to see the context.


    Please Login or Register  to view this content.
    This will update your specific cell on sheet "Update" with the value of any cell of sheet "Hours" that is changed. Now you may want to control / limit this action if a specific if a cell of "Hours" is within a given address , like if target.row = some rownumber and target.column = some column number etc.
    Teach me Excel VBA

  4. #4
    Registered User
    Join Date
    08-27-2018
    Location
    Naples, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Have attached a Workbook - please look at the first Tab called: Hours. Trying to update the Tab called: Actuals_Table. Tried to annotate in the Hours tab.

    Thank you in advance!
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Like this?

    PHP Code: 
    Sub UpdateColumns()
        
    Dim shMain As Worksheet
        Dim shToUpdate 
    As Worksheet
        Dim i 
    As Long
        
        Set shMain 
    Sheets("Hours")
        
    Set shToUpdate Sheets("Actuals_Table")
        
            
    With shMain
                
    For 6 To .Range("F17").End(xlToRight).Column
                    shToUpdate
    .Cells(.Cells(17i).Value, .Cells(18i).Value).Value = .Cells(19i).Value
                Next i
            End With
    End Sub 

  6. #6
    Registered User
    Join Date
    08-27-2018
    Location
    Naples, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Thank you. As mentioned, am really a novice. So, now that you've graciously written out the code for me...how to invoke?

    Assuming this gets copied into the "View Code" on the tabs...after that???????????

  7. #7
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Please see the attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-27-2018
    Location
    Naples, FL
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Thank you very much for all of your assistance!!!!!!! Very greatly appreciated.....

  9. #9
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    If it helps you and fully answers your question , please do the following

    1: Mark your thread as "Solved" (On top right of your first post in the current thread click on "Thread Tools>Mark as Solved"
    2: Give some rep to the post the post that helped you. (At bottom left side of the post that helped click on * button)
    Last edited by ImranBhatti; 08-29-2018 at 12:29 AM.

  10. #10
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: VBA Code to read value input on one sheet and update with that value on different shee

    Thanks for the rep+

+ 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. Want to update stock sheet as and when i enter product code in invoice sheet
    By anilpatni1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2017, 01:18 AM
  2. [SOLVED] Vba code to copy unique email id data from input sheet to output sheet
    By UPA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2017, 07:19 AM
  3. VBA Code to find range from Input sheet and hide respective columns in sheet 2.
    By skonduru in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2016, 11:56 AM
  4. [SOLVED] Update a date on Sheet 1 with radio buttons/input from Sheet 2
    By basic_coder in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2015, 10:17 AM
  5. Replies: 2
    Last Post: 06-04-2012, 06:57 AM
  6. Replies: 9
    Last Post: 04-04-2011, 12:03 AM

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