Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ella Campbell   on Oct 05 In MS Office Category.

  
Question Answered By: Fedde Bakker   on Oct 05

To add  three more columns  (ie only delete the last single column from
the raw data  (odd, because it seems to have more interesting data in
than the extra three you want to add which are just columns of 170s))
do the following:

change
Columns("I:L").Select
to
Columns("L").Select

change
Range(Cells(lastrow + 1, 4), Cells(lastrow + 1, 9)).Select
to
Range(Cells(lastrow + 1, 4), Cells(lastrow + 1, 12)).Select

change
Range(Cells(lastrow + 2, 4), Cells(lastrow + 2, 9)).Select
to
Range(Cells(lastrow + 2, 4), Cells(lastrow + 2, 12)).Select

You have already correctly added 3 more headings. The code for these
12 headings is a bit cumbersome and can be replaced by:

Range("A1") = "Item #"
Range("B1") = "ID SER#"
Range("C1") = "FLA"
Range("D1") = "FLC"
Range("E1") = "PFA"
Range("F1") = "PFC"
Range("G1") = "LLA"
Range("H1") = "LLC"
Range("I1") = "FLS"
Range("J1") = "FLB"
Range("K1") = "PFB"
Range("L1") = "LLS"

In addition there are a lot of lines just re-applying the defaults,
such as:
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False

The .HorizontalAlignment = xlCenter one is the only one doing
anything so this only needs one line like:
Range("A:A").HorizontalAlignment = xlCenter
or
Selection.HorizontalAlignment = xlCenter
etc.

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Editing macro Or get search suggestion and latest updates.


Tagged: