+ Reply to Thread
Results 1 to 7 of 7

Pinpoint a moving cell

Hybrid View

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

    Pinpoint a moving cell

    I have a range of data that has a header name. on the left of this range is a hidden column that is combining two cells into one cell name.( name and date). An example of this would be the name in cell b1 and the date in b3.($B$1&"-"&$B$3)
    I wish to copy this range of data down multiple times and with each copy change the name used as the header. The dates however will never change.
    what I would like is a macro of formula that will automatically recognize the new name cell and change the left formula to display the date and the new name.

    I have provided a working model to work with.
    Attached Files Attached Files

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

    Re: Pinpoint a moving cell

    Please read Forum Rule #8 about cross-posting.
    Cross-posted: https://www.mrexcel.com/forum/excel-...ving-cell.html
    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
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pinpoint a moving cell

    Select the range to copy and Run.
    Sub ppCopy()
      Dim p1 As Range, p2 As Range
      Dim r As Long, c1 As Range, c2 As Range
      Dim c As Range, s As String
      
      Set p1 = Selection
      Set p2 = Application.InputBox("Select TopLeft cell to pasted selection to.", _
        "Select Cell", Type:=8)
      Set p2 = p2.Resize(p1.Rows.Count, p1.Columns.Count)
      p1.Copy p2
      
      Set c1 = p1(1, 2) 'The old Name cell.
      Set c2 = p2(1, 2) 'The new Name cell.
      For r = 3 To p2.Rows.Count
        Set c = p2(r, 1)
        s = c.Formula
        c.Formula = Replace(s, c1.Address, c2.Address)
      Next r
      
      c2.Select 'Ready to change Name
    End Sub

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

    Re: Pinpoint a moving cell

    I must admit, I don't really understand this. What do I change to make it work for me?

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Pinpoint a moving cell

    Hi,

    Why don't you just use the Find/Replace dialog to replace $B$1 with B1 in the first block of formula cells. Then copying the block down will automatically look at the relevant header row.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

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

    Re: Pinpoint a moving cell

    I am building this to be shared between different departments as well as different sites in our company. This being the case I need it to be as self contained and automatic as possible. It is a lot easier to train someone to click on a macro or keyboard combination to activate the macro than the individual steps to accomplish a goal.

    This is one page on a very large document and what I am coding now is the add new associate macro that will automatically add a new employee to the individual pages and create all the links to the other individual pages so it all works seamlessly.

    Since each new employee will get their own "block" of 23 individual rows I need to be able to tell the workbook where to "look" for the new name and apply that location to all the links and formulas needed to make the page work right.

    the standard find and replace dialog works the easiest but in this case is not the solution I am looking for.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Pinpoint a moving cell

    I'm afraid I do not follow. Once you have done that to the first template block, all the macro needs to do is copy the block and paste it as many times as required. No further changes will be necessary.

+ 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. Pinpoint a specific cell according to other condition
    By chosford in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2013, 08:33 AM
  2. What is the best way to pinpoint a certain cell that has different locations?
    By kjy1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2013, 06:17 PM
  3. Auto-Converting Cell Value to link & moving rows of data based on cell value
    By Th3Forgotten in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-15-2013, 08:05 AM
  4. [SOLVED] How to pinpoint specific date from limiting ranges
    By narbit in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-16-2012, 04:01 PM
  5. Replies: 0
    Last Post: 05-21-2012, 06:59 AM
  6. Copying moving range based on moving cell reff.
    By Varmark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2011, 04:47 AM
  7. Replies: 4
    Last Post: 03-28-2005, 05:06 PM
  8. Replies: 7
    Last Post: 03-27-2005, 08:06 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