+ Reply to Thread
Results 1 to 13 of 13

copying cell data and updating other cells

  1. #1
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    copying cell data and updating other cells

    Is it possible to cut/paste partial data?

    cell A1 = 126.1.FB.NAS
    cell B1 = =QUOTE("126.1.FB.NAS","Symbol")

    All my cells in column A have the same data EXCEPT for the FB portion.This portion that i will manually update (eg change FB to something else that can be 2-4 digits such as 126.1.AABC.NAS or 126.1.WDS.NAS
    All my cells in column B have the same data and i want to copy the portion between the 126.1. (and) .NAS and insert the new portion (above) in it's place .

    so if cell A1 = 126.1.FB.NAS and cell B1 = QUOTE("126.1.FB.NAS","Symbol")
    and cell A2 = 126.1.AA.NAS then cell B2 = QUOTE("126.1.AA.NAS","Symbol")

    Again i will manually change the cells in column A but would like the cell's in column B to update accordingly.

    can anyone suggest how to do this?

    thanks in advance.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Click on a cell in column A, make the changes and press the RETURN key.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    thanks Mumps, I tried what you asked but didn't get it to work.
    Here's a copy of the file

    Cell A2 shows FB after 126.1.
    the FB is the area of the cell that i wish to change.

    Cell A3 shows FB replaced with AMZN
    this is providing the wrong result.

    I'm hoping for a way to change all the FB's in row 3 to AMZN without having to do this manually.

    Can you suggest any way to do this?

    thanks,
    Steve

  4. #4
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    hopefully my attachment work this time...
    Attached Files Attached Files

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    You said:
    so if cell A1 = 126.1.FB.NAS and cell B1 = QUOTE("126.1.FB.NAS","Symbol")
    and cell A2 = 126.1.AA.NAS then cell B2 = QUOTE("126.1.AA.NAS","Symbol")
    The macro I suggested does exactly what you described above. In the file you posted, cell A2 contains 126.1.FB.NAS. According to what you described in the above quote, if you change the FB to AMZN, then B2 should read QUOTE("126.1.AMZN.NAS","Symbol"). This is what the macro does. If this is not what you want, please attach a revised file that contains your actual data in the "Misc Stock" sheet and add another sheet that shows your desired results.

  6. #6
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    AH... i got this to work for the SYMBOL column - THANKS!

    When i paste the code under the 1st code and change the "Symbol" field to "Name" i'm hoping to update column C which is Name but I'm getting an error (ambiguous name detected: Worksheet_Change)
    Can you show me what to do to get the other columns to update too please?

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
    Target.Offset(, 1) = "=QUOTE(" & """" & Target & """" & "," & """" & "Symbol" & """" & ")"
    End Sub
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
    Target.Offset(, 1) = "=QUOTE(" & """" & Target & """" & "," & """" & "NAME" & """" & ")"
    End Sub

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    You can use only one Worksheet_Change event macro. You had two of them which generated the error. Try:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    Perfect! thanks Mumps!

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    You are very welcome.

  10. #10
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    I just noticed as i add more fields it stops updating for some reason. Am i supposed to change the Target.Offset (, 1) to (, 2) etc for each additional field?


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
    Target.Offset(, 1) = "=QUOTE(" & """" & Target & """" & "," & """" & "Symbol" & """" & ")"
    Target.Offset(, 2) = "=QUOTE(" & """" & Target & """" & "," & """" & "NAME" & """" & ")"
    Target.Offset(, 2) = "=QUOTE(" & """" & Target & """" & "," & """" & "CURRENCY" & """" & ")"
    Target.Offset(, 2) = "=QUOTE(" & """" & Target & """" & "," & """" & "LAST" & """" & ")"

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    The answer is "yes" if the columns that need to be change are consecutive so the offset would be 1, 2, 3, 4.

  12. #12
    Registered User
    Join Date
    09-22-2020
    Location
    canada
    MS-Off Ver
    office pro
    Posts
    13

    Re: copying cell data and updating other cells

    OK got it working now - thanks again Mumps1

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: copying cell data and updating other cells

    My pleasure.

+ 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. [SOLVED] Formula for updating a single cell from data entered into 12 other cells through the day
    By Craigretired in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-18-2014, 12:52 AM
  2. Copying Cells with Names - And Updating Reference
    By lesoies in forum Excel General
    Replies: 3
    Last Post: 02-16-2013, 01:38 AM
  3. Replies: 7
    Last Post: 02-07-2013, 10:07 PM
  4. Replies: 3
    Last Post: 12-13-2012, 03:50 PM
  5. Copying a range of cells and automatically updating
    By Wagstex in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-01-2012, 12:13 PM
  6. Data comparing, copying and updating
    By Lars.Olson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2012, 02:13 PM
  7. Copying information to multiple cells and updating lists
    By theface26 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-07-2009, 05:32 AM

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