|
| ||||||||||
| Tags: columns, excel, macro |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Macro to Add Columns in Excel
|
|
#2
| ||||
| ||||
| Re: Macro to Add Columns in Excel
Use this code : Code: Sub CalDat()
Dim wC As Worksheet
Dim wT As Worksheet
Dim rU As Range
Dim lRw As Long
Set wC = Sheets("Code")
Set wT = Sheets("T_Write_off")
Set rU = wsTWO.UsedRange
lRowEnd = rUsed.Rows.Count + rUsed.Row - 1
wT.Range("AH1:AJ1").Formula = wC.Range("AH1:AJ1").Formula
wT.Range("AH2:AJ" & lRowEnd).Formula = wC.Range("AH2:AJ2").Formula
wT.Activate
Range("A1").Select
Selection.End(xlToRight).Select
End Sub |
|
#3
| |||
| |||
| Re: Macro to Add Columns in Excel
Check this for example : Code: Sub addcol() LasCol = Cells(1, Colu.Count).End(xlToLeft).Column Colunt = LastCol Do While Colunt > 1 If Cells(1, Colunt) > Cells(1, ColCount - 1) + 1 Then Columns(Colunt).Insert Cells(1, Colunt) = Cells(1, ColCount + 1) - 1 Else Colunt = Colunt - 1 End If Loop |
|
#4
| ||||
| ||||
| Re: Macro to Add Columns in Excel
You need another macro to rearrange the position of columns. For eg. in excel there are A, B, C, D ,E1 COLUMNS. (three in your case). Split your screen, use the F8* key and see what you procedure does work in Excel. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Macro to Add Columns in Excel" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to divide two different columns data in Excel | Chini mao | Microsoft Project | 1 | 08-01-2012 05:47 PM |
| How to multiply two columns in Excel | Lanka Boy | Windows Software | 2 | 08-01-2012 02:06 AM |
| excel 2007 columns run right to left | Earth | MS Office Support | 4 | 26-10-2011 02:44 PM |
| Excel 2003 Macro doesn't work in Excel 2007 | jjaw | Windows Software | 1 | 16-04-2011 04:35 AM |
| Changing rows into columns in excel | Gannon | Windows Software | 5 | 25-12-2009 05:10 PM |