Pages

Tuesday, February 21, 2012

http://www.mrexcel.com/forum/showthread.php?t=520537


Sub CopyMacro()
ActiveSheet.Range("a65536").End(xlUp).EntireRow.Copy
ActiveSheet.Range("a65536").End(xlUp).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormats
ActiveSheet.Range("a65536").End(xlUp).Offset(1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End Sub



Sub addColumns()
Dim C As Long
Dim i As Long
C = ActiveSheet.UsedRange.Columns.Count
For i = C To 2 Step -1
Columns(i).Insert
Next
End Sub


Sub removeColumns()
Dim rng As Range
Dim C As Long
Dim i As Long
C = ActiveSheet.UsedRange.Columns.Count
For i = 1 To C
Set rng = ActiveSheet.Range(Cells(1, i), Cells(Rows.Count, i))
If Application.WorksheetFunction.CountA(rng) = 0 Then Columns(i).EntireColumn.Delete
Next i
End Sub

0 comments:

 

site weekly hits