+ Reply to Thread
Results 1 to 4 of 4

Update/refresh button

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2007
    Posts
    2

    Question Update/refresh button

    I have some thoughts about making a command,button or whatever that can ease my pricelist adjustment job.
    I have a price list of about 1000 rows. At the end of each row I have a cell with the actual price for the actual periode. The thing is that I update some of these prices once or twice a month. But now i want to add a new column where I type in the new price as I get it. Then when I have all the prices I need I was thinking about using a command button that will insert the new prices, that I have typed in, into the cells for the old prices. Like an update/refresh button actually.
    Is this in anyway possible? Do you excel pro's understand what I want to do?

    All answers appreciated

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Sub CopyNewPricees()
    
    '1 sheet named New Prices
    '1 sheet named Price List
    'this code copies the new prices to the price list
    'change ranges as required
        Sheets("New Prices").Range("A1:A15").Copy Destination:=Sheets("Price List").Range("I1")
    End Sub

  3. #3
    Registered User
    Join Date
    02-12-2007
    Posts
    2
    Quote Originally Posted by davesexcel
    Sub CopyNewPricees()
    
    '1 sheet named New Prices
    '1 sheet named Price List
    'this code copies the new prices to the price list
    'change ranges as required
        Sheets("New Prices").Range("A1:A15").Copy Destination:=Sheets("Price List").Range("I1")
    End Sub
    Thanks for the fast reply. I probobly should have mentioned that I am quite a newbie at Excel so could you please explain a little more. Do I make a button or how do I do this?
    Hope you can bare with me
    Lets say the the the cell with old prices is G3 and the new is G4 and they are both in the same sheet
    Last edited by synchro; 02-13-2007 at 08:13 AM.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I hope this helps to explain a little:
    <-copy from sheet->  <-copy from cells->      <--paste-->  <--paste to sheet--> <-paste to cell->
    Sheets("New Prices").Range("A1:A15").    Copy Destination:=Sheets("Price List").Range("I1")
    So to use a command button for your specific example above, first add the command button, then right-click the button and select view code. This will open up the VBE and generate something like this (excluding the green font):
    Private Sub CommandButton1_Click()
    Range("G4").Copy Destination:=Range("G3")
    End Sub
    Copy and paste the code in between the lines (I added the green code above for your example). Note that I did not use "Sheets". You can omit the sheet reference if the copy and paste destination are both on the active (selected) sheet. If they are on another sheet, or on separate sheets, add the Sheet reference as noted in the firts post.

+ 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