+ Reply to Thread
Results 1 to 3 of 3

Data pasted into a sheet, with functions referencing those cells, breaks the function

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2016
    Location
    America
    MS-Off Ver
    2010
    Posts
    10

    Data pasted into a sheet, with functions referencing those cells, breaks the function

    Hello,

    A few days ago one of the MVP's here wrote a macro that polled my database and copied the results onto another sheet. The program works nicely.

    I then added functions that built off of that data to build a graph from the new data.
    1) The original macro won't copy into the cells that are referenced by the new functions I added.
    2) When I manually cut/paste the macro's data into the range referenced by my new functions, the functions still do not return to original. I get a #REF! in all the cells.

    Can anyone tell me why? And what I can do to fix this?

    Thanks.

    DBoyd

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Data pasted into a sheet, with functions referencing those cells, breaks the function

    Quote Originally Posted by DBoyd121 View Post
    Can anyone tell me why? And what I can do to fix this?

    Thanks.

    DBoyd
    Probably, if you show us what you have, and what you did? Otherwise we are just working blind
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-16-2016
    Location
    North America
    MS-Off Ver
    2010
    Posts
    32

    Re: Data pasted into a sheet, with functions referencing those cells, breaks the function

    Hello,

    This is the macro that copies data onto another sheet. The attachment button doesn't seem to be working or I would attach the workbook.


    Sub ColQ()
        Dim i As Long, LR As Long
        Dim s1 As Worksheet, s2 As Worksheet
        Dim last As Long
    
        'names s1 and s2 as sheets1 and 2
        Set s1 = Sheets("Pre")
        Set s2 = Sheets("Sheet1")
            LR = s1.Range("Q" & Rows.Count).End(xlUp).Row
        
        With s1
            For i = 1 To LR
            last = s2.Range("B" & Rows.Count).End(xlUp).Row
                If IsNumeric(.Range("Q" & i)) Then
                    .Range("M" & i & ":P" & i).Copy
                    'paste values into columns B:P on sheet 2
                    s2.Range("B" & last + 1).PasteSpecial xlPasteValues
                End If
            Next i
        End With
    
    End Sub
    1) I've tried copying the data into tables and into unformatted cells.
    The data usually pastes at the end of the previously copied-into range. (even if I delete the previous attempt.) Sometimes it will copy into the beginning of the range but I don't know what I'm doing doing differently when it does.

    2) I have IFs using VLOOKUPs,and SUM functions, referencing the copied data.
    They all stop working when I manually or automatically paste data into the desired range.

    Thanks for the help.

    DBoyd

+ 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. VBA User Form needs to accept multiple lines/breaks pasted in it
    By swolfe2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2013, 11:50 AM
  2. Sorting sheet breaks up my referencing on other sheet..?!
    By mx5jmcb in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-02-2013, 02:39 PM
  3. [SOLVED] how to preserve paragraph breaks in pasted text?
    By Bob in forum Excel General
    Replies: 4
    Last Post: 07-25-2012, 10:33 AM
  4. Formula/function for referencing cells in sections of identical data
    By bluke12312 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-13-2010, 10:15 AM
  5. Referencing functions in a function?
    By blakrapter in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2010, 03:36 PM
  6. [SOLVED] Same formula referencing same cells returns incorrect results, randomly, when pasted into new worksheet
    By michelleelaine@hotmail.com in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-09-2006, 04:00 PM
  7. Referencing Cells Using If Functions
    By David Billigmeier in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 05:05 AM
  8. [SOLVED] Referencing Cells Using If Functions
    By Tonometer@yahoo.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 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