Macro that deletes empty columns

  • I have the following macros that copies and pastes data into another worksheet and formats column A as "Text". I then run the second macro that deletes empty columns, however, it also deletes the leading zeros in a cell (except fo Column A). The only way around this is to format the cells with leading zeros as "Text" and all is well. However, this is a problem as the cells with leading zeros can appear in several places;
    Column A being the constant (and is already formatted by the first macro) and the rest could appear in the following - E,F, K,L, Q,R, W,X, AC,AD, AI,AJ, AO,AP, AU,AV, BA,BB, BG,BH, BM,BN, BS,BT, BY,BZ, CE,CF, CK,CL, CQ,CR, CW,CX, DC,DD, DI,DJ, DO,DP, DU,DV, EA,EB, EG,EH, EM,EN, ES, ET ! I tried throwing in a macro to format these columns prior to running the delete columns but having a cell formatted to "Text" that is empty stops the macro in its' tracks. Basically I do not want to have to format the data with leading zeros manually. Is there a way that the macro can deal with these cells (that are "General" formatted) without losing the leading zeros? Here are the two macros in use;



    And the other macro is



    This is hopefully the last hurdle I have with this process.


    Many thanks in advance


    TP59

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!