+ Reply to Thread
Results 1 to 6 of 6

reformat VBA

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    reformat VBA

    I am trying to reformat a worksheet and am having trouble with a VBA to do this. The 5 steps are below and an example is attached.

    Also, the rows #'s for columns can be variable but the column headers are always the same.

    For example, in the attached there are 183 rows, but in the next there might be 200 rows to reformat. Thank you very much.

    Step 1: Rename column
    AK – Index
    AL – deleted
    AM – Gene
    AN – mRNA
    AO and AP (deleted)
    AQ – Coverage
    AR – Score
    AS – A(#F,#R)
    AT – C(#F,#R)
    AU – G(#F,#R)
    AV – T(#F,#R)
    AW – Ins(#F,#R)
    AX - Del(#F,#R)
    AY- SNP
    AZ – Mutation
    BA – Frequency
    BB – AminoAcid

    Step 2: move renamed columns
    Start at column A, Row 4

    Step 3: delete columns AP (Otherinfo) to BQ (Amino Acid)

    Step 4: Rename column
    AP – Homopolymer
    AQ – CDS
    AR – Splice
    AS – Strand Bias
    AT – Classification
    AU- HGMD
    AV – Disease
    AW – References
    AX – Sanger

    Step 5: Insert column header in A1 and B1 and highlight cells yellow in A1,A2,B1,B2
    A1 – Name
    B1 - Gender
    A2 – “leave blank”
    B2- “leave blank”
    A3 – “leave blank”
    B4 – “leave blank”
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: reformat VBA

    Are you starting by deleting columns A to AJ?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: reformat VBA

    No, those columns are just moved to the right to make room for the inserted columns.

    I forgot a step as well, can a column "Inheritance" be added to C4? I updated the workbook with the change as well. Thanks
    Attached Files Attached Files

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: reformat VBA

    Perhaps.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: reformat VBA

    Thank you very much, the code works great.

  6. #6
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: reformat VBA

    Since my data is dependent on the test that is run is it possible to not use a column but a range instead? For example, in the attached data there are examples of the data in tab One and Two. In workbook Two there are 3 additional columns. I'm not sure the best way to reformat the data.

    The code from post 1 (classify) works great for the first condition, but since there are additional columns in the second condition it does not.

    Column AK in One starts the code
    Column AL in Two stars the code

    Any ideas ? Thanks.
    Attached Files Attached Files

+ 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] Reformat a Date?
    By SueWithQuestion in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-27-2012, 09:18 AM
  2. I can't reformat a cell the way I want... please help
    By Tony Gambino in forum Excel General
    Replies: 3
    Last Post: 04-23-2012, 02:32 PM
  3. Reformat Date
    By mlindquist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2006, 01:02 PM
  4. [SOLVED] Reformat Number
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-16-2006, 03:30 PM
  5. reformat cells
    By broken in forum Excel General
    Replies: 1
    Last Post: 07-25-2005, 10:05 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