patayloruk
New Member
- Joined
- Nov 2, 2005
- Messages
- 9
Hello all, hope someone can push me in the right direction with this one.
I have an excel sheet which is used as a wire list for an aircraft.
I am trying to optomise the code as this routine takes over 10 seconds on sheet activation.
I have 2 versions here but the second is no quicker
FIRST VERSION
Sub copyandsort()
Sheets("Connector pin list").Select
Cells.Select
Selection.Delete
Range("A2").Select
ActiveWindow.FreezePanes = False
nCol = 1
While Not (ColHd = "End of Columns")
ColHd = Sheet3.Cells(1, nCol)
If (ColHd = "WN") Then col1 = nCol
If (ColHd = "From Data 2") Then col2 = nCol
If (ColHd = "To Data 2") Then Col3 = nCol
If (ColHd = "sort") Then Col4 = nCol
If (ColHd = "Diagram") Then Col5 = nCol
If (ColHd = "Wire Type") Then Col6 = nCol
If (ColHd = "Length adjusted") Then Col7 = nCol
If (ColHd = "sort2") Then Col8 = nCol
If (ColHd = "Cable Assy") Then Col9 = nCol
If (ColHd = "From Conn") Then Col10 = nCol
If (ColHd = "To Conn") Then Col11 = nCol
nCol = nCol + 1
Wend
nlin = 2
While Not (Sheet3.Cells(nlin, col1) = "")
txt1 = Sheet3.Cells(nlin, col1)
txt2 = Sheet3.Cells(nlin, col2)
txt3 = Sheet3.Cells(nlin, Col3)
txt4 = Sheet3.Cells(nlin, Col4)
txt5 = Sheet3.Cells(nlin, Col5)
txt6 = Sheet3.Cells(nlin, Col6)
txt7 = Sheet3.Cells(nlin, Col7)
txt8 = Sheet3.Cells(nlin, Col8)
txt9 = Sheet3.Cells(nlin, Col9)
txt10 = Sheet3.Cells(nlin, Col10)
Txt11 = Sheet3.Cells(nlin, Col11)
Sheet6.Cells(nlin - 1, 1) = txt2
Sheet6.Cells(nlin - 1, 2) = txt1
Sheet6.Cells(nlin - 1, 3) = txt3
Sheet6.Cells(nlin - 1, 4) = txt4
Sheet6.Cells(nlin - 1, 5) = txt5
Sheet6.Cells(nlin - 1, 6) = txt6
Sheet6.Cells(nlin - 1, 7) = txt7
Sheet6.Cells(nlin - 1, 9) = txt9
Sheet6.Cells(nlin - 1, 10) = txt10
Sheet6.Cells(nlin - 1, 11) = Txt11
nlin = nlin + 1
Wend
nLin3 = 2
While Not (Sheet3.Cells(nLin3, col1) = "")
txt1 = Sheet3.Cells(nLin3, col1)
txt2 = Sheet3.Cells(nLin3, col2)
txt3 = Sheet3.Cells(nLin3, Col3)
txt4 = Sheet3.Cells(nLin3, Col4)
txt5 = Sheet3.Cells(nLin3, Col5)
txt6 = Sheet3.Cells(nLin3, Col6)
txt7 = Sheet3.Cells(nLin3, Col7)
txt8 = Sheet3.Cells(nLin3, Col8)
txt9 = Sheet3.Cells(nLin3, Col9)
txt10 = Sheet3.Cells(nLin3, Col10)
Txt11 = Sheet3.Cells(nLin3, Col11)
Sheet6.Cells(nlin + nLin3 - 1, 1) = txt3
Sheet6.Cells(nlin + nLin3 - 1, 2) = txt1
Sheet6.Cells(nlin + nLin3 - 1, 3) = txt2
Sheet6.Cells(nlin + nLin3 - 1, 4) = txt8
Sheet6.Cells(nlin + nLin3 - 1, 5) = txt5
Sheet6.Cells(nlin + nLin3 - 1, 6) = txt6
Sheet6.Cells(nlin + nLin3 - 1, 7) = txt7
Sheet6.Cells(nlin + nLin3 - 1, 9) = txt9
Sheet6.Cells(nlin + nLin3 - 1, 10) = Txt11
Sheet6.Cells(nlin + nLin3 - 1, 11) = txt10
nLin3 = nLin3 + 1
Wend
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
ActiveCell.FormulaR1C1 = "From"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Wire Code"
Range("C1").Select
ActiveCell.FormulaR1C1 = "To"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Drawing"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Wire Type"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Length"
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.RowHeight = 40
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.sort Key1:=Range("J1"), Order1:=xlAscending, Key2:=Range("D1") _
, Order2:=xlAscending, Key3:=Range("B1") _
, Order3:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Columns("D:D").Select
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("A2").Select
Columns("A:D").ColumnWidth = 18
Columns("E:E").ColumnWidth = 18
ActiveSheet.Shapes("CommandButton1").Select
Selection.ShapeRange.Left = 0
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton2").Select
Selection.ShapeRange.Left = 100
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton3").Select
Selection.ShapeRange.Left = 197
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton4").Select
Selection.ShapeRange.Left = 300
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton5").Select
Selection.ShapeRange.Left = 460
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton6").Select
Selection.ShapeRange.Left = 620
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton7").Select
Selection.ShapeRange.Left = 820
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 10
Selection.ShapeRange.Height = 10
Sheets("Connector pin list").Select
Selection.AutoFilter
CommandButton3.Enabled = False
End Sub
SECOND VERSION
Sub copyandsort()
Sheets("Connector pin list").Select
Cells.Select
Selection.Delete
Range("A2").Select
ActiveWindow.FreezePanes = False
Dim getdata As Range
Application.ScreenUpdating = False
sheet3length = 2
While Not Sheet3.Cells(sheet3length, 4) = ""
sheet3length = sheet3length + 1
Wend
RowRange = "I2:AL" & sheet3length
Set getdata = Worksheets("Wire List Data").Range(RowRange)
rowno = 2
Do
Sheet6.Cells(rowno, 1) = getdata(rowno - 1, 29) ' to
Sheet6.Cells(rowno, 2) = getdata(rowno - 1, 1)
Sheet6.Cells(rowno, 3) = getdata(rowno - 1, 30) ' from
Sheet6.Cells(rowno, 4) = getdata(rowno - 1, 11)
Sheet6.Cells(rowno, 5) = getdata(rowno - 1, 13)
Sheet6.Cells(rowno, 6) = getdata(rowno - 1, 4)
Sheet6.Cells(rowno, 7) = getdata(rowno - 1, 7)
Sheet6.Cells(rowno, 9) = getdata(rowno - 1, 23)
Sheet6.Cells(rowno, 10) = getdata(rowno - 1, 9)
Sheet6.Cells(rowno, 11) = getdata(rowno - 1, 17)
rowno = rowno + 1
Loop Until getdata(rowno - 1, 1) = ""
rowno = sheet3length
rowno2 = 1
Do
Sheet6.Cells(rowno, 1) = getdata(rowno2, 30) ' from
Sheet6.Cells(rowno, 2) = getdata(rowno2, 1)
Sheet6.Cells(rowno, 3) = getdata(rowno2, 29) ' to
Sheet6.Cells(rowno, 4) = getdata(rowno2, 19)
Sheet6.Cells(rowno, 5) = getdata(rowno2, 13)
Sheet6.Cells(rowno, 6) = getdata(rowno2, 4)
Sheet6.Cells(rowno, 7) = getdata(rowno2, 7)
Sheet6.Cells(rowno, 9) = getdata(rowno2, 23)
Sheet6.Cells(rowno, 10) = getdata(rowno2, 17)
Sheet6.Cells(rowno, 11) = getdata(rowno2, 9)
rowno = rowno + 1
rowno2 = rowno2 + 1
Loop Until getdata(rowno2, 1) = ""
Range("A1").Select
ActiveCell.FormulaR1C1 = "From"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Wire Code"
Range("C1").Select
ActiveCell.FormulaR1C1 = "To"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Drawing"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Wire Type"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Length"
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.RowHeight = 40
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.sort Key1:=Range("J1"), Order1:=xlAscending, Key2:=Range("D1") _
, Order2:=xlAscending, Key3:=Range("B1") _
, Order3:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Columns("D:D").Select
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("A2").Select
Columns("A:D").ColumnWidth = 18
Columns("E:E").ColumnWidth = 18
ActiveSheet.Shapes("CommandButton1").Select
Selection.ShapeRange.Left = 0
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton2").Select
Selection.ShapeRange.Left = 100
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton3").Select
Selection.ShapeRange.Left = 197
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton4").Select
Selection.ShapeRange.Left = 300
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton5").Select
Selection.ShapeRange.Left = 460
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton6").Select
Selection.ShapeRange.Left = 620
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton7").Select
Selection.ShapeRange.Left = 820
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 10
Selection.ShapeRange.Height = 10
Sheets("Connector pin list").Select
Selection.AutoFilter
CommandButton3.Enabled = False
End Sub
Any ideas?
please excuse my bad programming. (new to this)
I have an excel sheet which is used as a wire list for an aircraft.
I am trying to optomise the code as this routine takes over 10 seconds on sheet activation.
I have 2 versions here but the second is no quicker
FIRST VERSION
Sub copyandsort()
Sheets("Connector pin list").Select
Cells.Select
Selection.Delete
Range("A2").Select
ActiveWindow.FreezePanes = False
nCol = 1
While Not (ColHd = "End of Columns")
ColHd = Sheet3.Cells(1, nCol)
If (ColHd = "WN") Then col1 = nCol
If (ColHd = "From Data 2") Then col2 = nCol
If (ColHd = "To Data 2") Then Col3 = nCol
If (ColHd = "sort") Then Col4 = nCol
If (ColHd = "Diagram") Then Col5 = nCol
If (ColHd = "Wire Type") Then Col6 = nCol
If (ColHd = "Length adjusted") Then Col7 = nCol
If (ColHd = "sort2") Then Col8 = nCol
If (ColHd = "Cable Assy") Then Col9 = nCol
If (ColHd = "From Conn") Then Col10 = nCol
If (ColHd = "To Conn") Then Col11 = nCol
nCol = nCol + 1
Wend
nlin = 2
While Not (Sheet3.Cells(nlin, col1) = "")
txt1 = Sheet3.Cells(nlin, col1)
txt2 = Sheet3.Cells(nlin, col2)
txt3 = Sheet3.Cells(nlin, Col3)
txt4 = Sheet3.Cells(nlin, Col4)
txt5 = Sheet3.Cells(nlin, Col5)
txt6 = Sheet3.Cells(nlin, Col6)
txt7 = Sheet3.Cells(nlin, Col7)
txt8 = Sheet3.Cells(nlin, Col8)
txt9 = Sheet3.Cells(nlin, Col9)
txt10 = Sheet3.Cells(nlin, Col10)
Txt11 = Sheet3.Cells(nlin, Col11)
Sheet6.Cells(nlin - 1, 1) = txt2
Sheet6.Cells(nlin - 1, 2) = txt1
Sheet6.Cells(nlin - 1, 3) = txt3
Sheet6.Cells(nlin - 1, 4) = txt4
Sheet6.Cells(nlin - 1, 5) = txt5
Sheet6.Cells(nlin - 1, 6) = txt6
Sheet6.Cells(nlin - 1, 7) = txt7
Sheet6.Cells(nlin - 1, 9) = txt9
Sheet6.Cells(nlin - 1, 10) = txt10
Sheet6.Cells(nlin - 1, 11) = Txt11
nlin = nlin + 1
Wend
nLin3 = 2
While Not (Sheet3.Cells(nLin3, col1) = "")
txt1 = Sheet3.Cells(nLin3, col1)
txt2 = Sheet3.Cells(nLin3, col2)
txt3 = Sheet3.Cells(nLin3, Col3)
txt4 = Sheet3.Cells(nLin3, Col4)
txt5 = Sheet3.Cells(nLin3, Col5)
txt6 = Sheet3.Cells(nLin3, Col6)
txt7 = Sheet3.Cells(nLin3, Col7)
txt8 = Sheet3.Cells(nLin3, Col8)
txt9 = Sheet3.Cells(nLin3, Col9)
txt10 = Sheet3.Cells(nLin3, Col10)
Txt11 = Sheet3.Cells(nLin3, Col11)
Sheet6.Cells(nlin + nLin3 - 1, 1) = txt3
Sheet6.Cells(nlin + nLin3 - 1, 2) = txt1
Sheet6.Cells(nlin + nLin3 - 1, 3) = txt2
Sheet6.Cells(nlin + nLin3 - 1, 4) = txt8
Sheet6.Cells(nlin + nLin3 - 1, 5) = txt5
Sheet6.Cells(nlin + nLin3 - 1, 6) = txt6
Sheet6.Cells(nlin + nLin3 - 1, 7) = txt7
Sheet6.Cells(nlin + nLin3 - 1, 9) = txt9
Sheet6.Cells(nlin + nLin3 - 1, 10) = Txt11
Sheet6.Cells(nlin + nLin3 - 1, 11) = txt10
nLin3 = nLin3 + 1
Wend
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
ActiveCell.FormulaR1C1 = "From"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Wire Code"
Range("C1").Select
ActiveCell.FormulaR1C1 = "To"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Drawing"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Wire Type"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Length"
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.RowHeight = 40
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.sort Key1:=Range("J1"), Order1:=xlAscending, Key2:=Range("D1") _
, Order2:=xlAscending, Key3:=Range("B1") _
, Order3:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Columns("D:D").Select
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("A2").Select
Columns("A:D").ColumnWidth = 18
Columns("E:E").ColumnWidth = 18
ActiveSheet.Shapes("CommandButton1").Select
Selection.ShapeRange.Left = 0
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton2").Select
Selection.ShapeRange.Left = 100
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton3").Select
Selection.ShapeRange.Left = 197
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton4").Select
Selection.ShapeRange.Left = 300
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton5").Select
Selection.ShapeRange.Left = 460
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton6").Select
Selection.ShapeRange.Left = 620
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton7").Select
Selection.ShapeRange.Left = 820
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 10
Selection.ShapeRange.Height = 10
Sheets("Connector pin list").Select
Selection.AutoFilter
CommandButton3.Enabled = False
End Sub
SECOND VERSION
Sub copyandsort()
Sheets("Connector pin list").Select
Cells.Select
Selection.Delete
Range("A2").Select
ActiveWindow.FreezePanes = False
Dim getdata As Range
Application.ScreenUpdating = False
sheet3length = 2
While Not Sheet3.Cells(sheet3length, 4) = ""
sheet3length = sheet3length + 1
Wend
RowRange = "I2:AL" & sheet3length
Set getdata = Worksheets("Wire List Data").Range(RowRange)
rowno = 2
Do
Sheet6.Cells(rowno, 1) = getdata(rowno - 1, 29) ' to
Sheet6.Cells(rowno, 2) = getdata(rowno - 1, 1)
Sheet6.Cells(rowno, 3) = getdata(rowno - 1, 30) ' from
Sheet6.Cells(rowno, 4) = getdata(rowno - 1, 11)
Sheet6.Cells(rowno, 5) = getdata(rowno - 1, 13)
Sheet6.Cells(rowno, 6) = getdata(rowno - 1, 4)
Sheet6.Cells(rowno, 7) = getdata(rowno - 1, 7)
Sheet6.Cells(rowno, 9) = getdata(rowno - 1, 23)
Sheet6.Cells(rowno, 10) = getdata(rowno - 1, 9)
Sheet6.Cells(rowno, 11) = getdata(rowno - 1, 17)
rowno = rowno + 1
Loop Until getdata(rowno - 1, 1) = ""
rowno = sheet3length
rowno2 = 1
Do
Sheet6.Cells(rowno, 1) = getdata(rowno2, 30) ' from
Sheet6.Cells(rowno, 2) = getdata(rowno2, 1)
Sheet6.Cells(rowno, 3) = getdata(rowno2, 29) ' to
Sheet6.Cells(rowno, 4) = getdata(rowno2, 19)
Sheet6.Cells(rowno, 5) = getdata(rowno2, 13)
Sheet6.Cells(rowno, 6) = getdata(rowno2, 4)
Sheet6.Cells(rowno, 7) = getdata(rowno2, 7)
Sheet6.Cells(rowno, 9) = getdata(rowno2, 23)
Sheet6.Cells(rowno, 10) = getdata(rowno2, 17)
Sheet6.Cells(rowno, 11) = getdata(rowno2, 9)
rowno = rowno + 1
rowno2 = rowno2 + 1
Loop Until getdata(rowno2, 1) = ""
Range("A1").Select
ActiveCell.FormulaR1C1 = "From"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Wire Code"
Range("C1").Select
ActiveCell.FormulaR1C1 = "To"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Drawing"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Wire Type"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Length"
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Rows("1:1").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.RowHeight = 40
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.sort Key1:=Range("J1"), Order1:=xlAscending, Key2:=Range("D1") _
, Order2:=xlAscending, Key3:=Range("B1") _
, Order3:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
Columns("D:D").Select
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
Columns("I:J").Select
Selection.Delete Shift:=xlToLeft
Range("A2").Select
Columns("A:D").ColumnWidth = 18
Columns("E:E").ColumnWidth = 18
ActiveSheet.Shapes("CommandButton1").Select
Selection.ShapeRange.Left = 0
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton2").Select
Selection.ShapeRange.Left = 100
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton3").Select
Selection.ShapeRange.Left = 197
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 96
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton4").Select
Selection.ShapeRange.Left = 300
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton5").Select
Selection.ShapeRange.Left = 460
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton6").Select
Selection.ShapeRange.Left = 620
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 150
Selection.ShapeRange.Height = 21
ActiveSheet.Shapes("CommandButton7").Select
Selection.ShapeRange.Left = 820
Selection.ShapeRange.Top = 0
Selection.ShapeRange.Width = 10
Selection.ShapeRange.Height = 10
Sheets("Connector pin list").Select
Selection.AutoFilter
CommandButton3.Enabled = False
End Sub
Any ideas?
please excuse my bad programming. (new to this)