+ Reply to Thread
Results 1 to 3 of 3

Solving #REF! problem with vba

  1. #1
    Registered User
    Join Date
    03-16-2016
    Location
    Hungary
    MS-Off Ver
    2013
    Posts
    1

    Solving #REF! problem with vba

    Hey Guys,

    I have a problem. I have a workbook which have a sheet called CUT. That's a fixed sheet with a drop down list and some cells referencing to an other sheet called Database. Everytime a refresh occurs I need to delete the sheet Database and replace it with a new one from an other workbook.

    Well when i do that I get a #ref! error in the cells with formulas referencing to some cells on sheet Database. (of course, it was deleted and replaced)

    Now I need to create a macro that corrects the #ref! parts in the formulas with the correct reference.
    - First I tried find and replace. I recorded a macro while doing it (1)showing the formulas 2)replace-find 3)hide formmulas), but it messed up when I tried it the second time. It's changed #REF! to something like "Database!B:S:B'S:S" and things like that instead of just "Database!B:S".
    - Secondly I tried writing the correct formula again into the cells. Now when it's a simple thing like iferror and vlookup then it works fine. But when it became more complicated like multi-level IFs then it gives me "Runtime error 1004: Application-defined or object-defined error"
    I don't understand it since I did not change anything, it is a recorded macro...

    Can someone help me where could the problem be? Or any other solution to get through the #REF! Error?

    (sorry I couldn't paste the code since the site's firewall don't allow me to put html codes in)

    Thank you!

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,706

    Re: Solving #REF! problem with vba

    1) simple: you can try to use indirect to "produce address" on the fly.
    like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    instead of
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    2) medium: think of clearing contents of your old database sheet and then copying contents from new sheet into it (not deleting old and pasting new sheet)
    3) probably toughest, especially with nested formulas: Review and changing formulas with #REF! is not that easy (you noticed that :-P ), but carefull planning shall allow it. If that is not easy enough think of solutions 1 and 2 above
    Best Regards,

    Kaper

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448
    Start your Macro Recorder.

    Select each cell that has a formulavreferencing your database sheet in turn and Click on the right hand side ofvtge formuls and press enter.

    Stop your macro recorder.

    You have created a macro that will fix your ref issues.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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. could any 1 help me in solving this problem..
    By banilam in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-30-2013, 07:48 PM
  2. Problem solving in VBA
    By Lv27 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2012, 10:17 AM
  3. I need a help in solving this problem
    By jkarthi22 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-24-2007, 11:36 AM
  4. Solving Problem
    By jocpinmn in forum Excel General
    Replies: 2
    Last Post: 05-26-2007, 10:13 AM
  5. Need help solving this problem
    By Stan T in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-25-2006, 03:09 PM
  6. [SOLVED] Conditional Problem Solving
    By Andrew in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2006, 12:45 AM
  7. problem solving website
    By anoopcosmos in forum Excel General
    Replies: 0
    Last Post: 05-08-2005, 02:33 PM
  8. problem solving
    By ClayTele in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-16-2005, 03:04 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