+ Reply to Thread
Results 1 to 6 of 6

Fixing problems in a slightly corrupt workbook

  1. #1
    Registered User
    Join Date
    09-22-2008
    Location
    Rhode Island
    Posts
    25

    Fixing problems in a slightly corrupt workbook

    Gentlemen and ladies:

    I am working with a spreadsheet I downloaded from a web site. Unfortunately, in this particular one (there are a series from this site), something went wrong. Colum A is supposed to be a year, but in quite a number of entries, column A was left blank, and the year was put into column B. There are several thousand rows in the spreadsheet and fixing this by hand would be laborious.

    Is there some simple way to ask excel to put the value in column into column A if the value of column A is blank? Another possible approach would be to ask excel to copy column B into column A is that value is numeric--the misplaced years are the only numeric values in column B.

    Thanks in advance.

    DK

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Fixing problems in a slightly corrupt workbook

    Do you need the whole row to shift left if the year was entered into B? Is there other data?

    If shifting left is okay, you could hightlight the range, hit F5, choose Special, choose Blanks, then goto Cell under Home tab and delete cells, shifting left.

    If not, you could apply a short VB script.

    Please Login or Register  to view this content.
    That code goes in VB editor. Alt+F11, Insert, New Module, paste code. Adjust range of cells if too big or too small. Close that window.

    Call macros with Alt+F8

    That short piece of script just runs down a2:a25000, looks for blank cells, when it finds one, copies the adjacent cell into it, and clears that cell.
    Last edited by daffodil11; 11-24-2014 at 03:54 PM.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    09-22-2008
    Location
    Rhode Island
    Posts
    25

    Re: Fixing problems in a slightly corrupt workbook

    thank you. No, I do NOT need to shift all the columns in the row--on the contrary. I will try the second fix. Thanks.

    DK

  4. #4
    Registered User
    Join Date
    09-22-2008
    Location
    Rhode Island
    Posts
    25

    Re: Fixing problems in a slightly corrupt workbook

    Quote Originally Posted by daffodil11 View Post
    Do you need the whole row to shift left if the year was entered into B? Is there other data?

    If shifting left is okay, you could hightlight the range, hit F5, choose Special, choose Blanks, then goto Cell under Home tab and delete cells, shifting left.

    If not, you could apply a short VB script.

    Please Login or Register  to view this content.
    That code goes in VB editor. Alt+F11, Insert, New Module, paste code. Adjust range of cells if too big or too small. Close that window.

    Call macros with Alt+F8

    That short piece of script just runs down a2:a25000, looks for blank cells, when it finds one, copies the adjacent cell into it, and clears that cell.
    Alas, I did as you said with the script, and it came up to run when I did ALT-F8, but nothing happened. Is it possible that you forgot something? Thanks.

    DK
    FF

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Fixing problems in a slightly corrupt workbook

    Perhaps each cell is not blank? Maybe it has only a space in it or an invisible character?

    You could try:

    Please Login or Register  to view this content.
    Which will execute on cells with less than 4 characters.

  6. #6
    Registered User
    Join Date
    09-22-2008
    Location
    Rhode Island
    Posts
    25

    Re: Fixing problems in a slightly corrupt workbook

    As it happens, I figured out a work-around of my own--I can just separate out those rows. Thank you for your time. I will have another question of a different type shortly.

    David K

+ 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] Problems with VLOOKUP connecting cells that have slightly different spellings
    By chilli76 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-06-2014, 11:38 AM
  2. Application.DisplayAlerts seems to corrupt workbook
    By kjg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2012, 04:16 AM
  3. Corrupt Workbook
    By SDruley in forum Excel General
    Replies: 12
    Last Post: 09-26-2009, 12:09 AM
  4. Rescuing Sheets in Corrupt Workbook
    By Michael Link in forum Excel General
    Replies: 4
    Last Post: 07-24-2006, 02:10 PM
  5. Removing Corrupt styles in an excel workbook
    By anonymouse in forum Excel General
    Replies: 1
    Last Post: 12-17-2005, 11:25 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