how do i learn to write excel macros?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do i delete blank cells and align properly through macro?
LIke
National Oilwell
0
Page Number - 1
I N V O I C E
SHCNID:
Date 11/5/2006
Orderd By: Salesperson: 7200
Customer -
Brn/Plt 9327
-
259309
Sold To: NATIONAL OILWELL MIDDLE EAST SAUDIA ARAB Ship To: NATIONAL
OILWELL MIDDLE EAST SAUDIA ARAB Related P.O. -
ST
DOWNHOLE TOOLS DIVISION DOWNHOLE TOOLS DIVISION Order Nbr -
P O BOX 299 P O BOX 299 Invoice -
DAMMAM SAUDIA ARABIA SAUDIA ARABI DAMMAM SAUDIA ARABIA SAUDIA
ARABI
SHETTYHB
BP Ph 971 4-8838776
BP Fax ax 4-8838795
A1 DOWNHOLE TOOLS DIVISION
A2 P O BOX 61490
A3 R/A # 13, PLOT MO 0682
A4 DAIMLER CHRYSLER ST
JEBEL ALI FREE ZONE DUBAI
Tax ID:
Country AE
Tax Cert:
Zone Blank
Request Date Customer P.O. F.O.B. Ship :
9/5/2006 . Inst :
Ln/Rq Dt Description Item Number UM Price Extended Price Tax
Payment Terms
AV
AA
HYDRAULIC HOUSING N
1 336-C-4 S 802.8449 802.84 AB
9/5/2006 8" HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
HYDRAULIC HOUSING 8" HYDRAULIC/MECHANICAL JAR
AI
AA
SPLINED HOUSING N
2 381-C-3 S 1492.1954 1492.2 AB
9/5/2006 9 1/2 HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SPLINED HOUSING 9 1/2 HYDRAULIC/MECHANICAL JAR
AI
AA
BOTTOM SUB N
3 381-C-5 S 1413.7735 1413.77 AB
9/5/2006 9 1/2 HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
BOTTOM SUB 9 1/2 HYDRAULIC/MECHANICAL JAR
AI
AA
KNOCKER HOUSING N
4 336-C-3 S 893.9426 1787.89 AB
9/5/2006 8" HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
KNOCKER HOUSING 8" HYDRAULIC/MECHANICAL JAR
AI
AA
BALANCING SLEEVE N
5 380-B-4 S 73.5658 147.13 AB
9/5/2006 4 3/4 HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
BALANCING SLEEVE 4 3/4 HYDRAULIC/MECHANICAL JAR
AI
AA
VALVE N
6 474-B-18 S 139.7974 279.59 AB
9/5/2006 6 1/2" HYDR/MECH JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
VALVE 6 1/2" HYDR/MECH JAR
AI
AA
BALANCING SLEEVE N
7 474-B-2 S 169.351 338.7 AB
9/5/2006 6 1/2" HYD/MECH JAR 2.75" BORE EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
BALANCING SLEEVE 6 1/2" HYD/MECH JAR 2.75" BORE
AI
AA
LATCH MANDREL N
8 474-C-8 S 570.917 1141.83 AB
9/5/2006 6 1/2" HYD/MECH JAR 2.75" BORE EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
LATCH MANDREL 6 1/2" HYD/MECH JAR 2.75" BORE
AI
AA
WEAR RING N
9 119-B-14 S 32.6407 32.64 AB
9/5/2006 9" SHOCK TOOL EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
WEAR RING 9" SHOCK TOOL
AI
AA
BOTTOM SUB - EXTENDED N
10 336-C-23 S 916.8252 916.83 AB
9/5/2006 8" HYD/MECH JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
BOTTOM SUB - EXTENDED 8" HYD/MECH JAR
AI
AA
SPLINED HOUSING N
11 143-D-2 S 2271.9923 2271.99 AB
9/5/2006 12" SHOCK TOOL EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SPLINED HOUSING 12" SHOCK TOOL
AI
AA
SEAL KIT 300°F(150°C)MAX N
12 381-120 S 89.1454 356.58 AB
9/5/2006 9-9 1/2" HYD/MECH JAR B EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SEAL KIT 300°F(150°C)MAX 9-9 1/2" HYD/MECH JAR
AI
AA
SEAL KIT 300°F(150°C)MAX N
13 474-120 S 40.5924 405.92 AB
9/5/2006 6 1/2" HYD/MECH JAR 2.75" BORE EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SEAL KIT 300°F(150°C)MAX 6 1/2" HYD/MECH JAR 2.75" BORE
AI
AA
SPRING N
14 143-B-10 S 39.2348 784.7 AB
9/5/2006 MS032(5160) 9 1/2"o EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SPRING MS032(5160) 9 1/2"o
AI
AA
SEAL KIT 200°F(95°C)MAX N
15 143-100 S 61.0531 915.8 AB
9/5/2006 12" SHOCK TOOL EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
SEAL KIT 200°F(95°C)MAX 12" SHOCK TOOL
AI
AA
LATCH MANDREL N
16 380-C-14 S 407.4574 1222.37 AB
9/5/2006 4 3/4 HYDRAULIC/MECHANICAL JAR EA LB AC
Business Unit 9327 AD
AE
AF
AG
AH
AJ
LATCH MANDREL 4 3/4 HYDRAULIC/MECHANICAL JAR
AI
Sales Tax Total Order
Net Due Date 10/6/2006 0% 14310.78
Terms Net 30 Days
 
Does this help?

Sub NoBlanksAligLeft()

Columns("A:A").SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp
Columns("A:A").HorizontalAlignment = xlLeft

End Sub
 
My guess is that it has too many limitations, being restricted to
column A and without regard to rest of cells on the row. But the
question is too ambiguous anyway.

Some more examples of deleting cells and rows in
Delete Cells/Rows in Range, based on empty cells, or cells with specific values
http://www.mvps.org/dmcritchie/excel/delempty.htm

Can't read the example but I think the interest is probably in deleting rows
which would bring you down to the second half of the above.

As for the subject title you might look at some VBA tutorials on my page
http://www.mvps.org/dmcritchie/excel/excel.htm#tutorials
and also you would want to write code that runs quickly as opposed to just working
http://www.mvps.org/dmcritchie/excel/proper.htm
http://www.mvps.org/dmcritchie/excel/slowresp.htm
 
Back
Top