D
Daminc
I made this little macro this morning which may help someone who visits
this forum
I don't know if this is an efficient way of doing this but then again
I'm only a beginner so I have an excuse
Code:
--------------------
Public Sub swopcolumn()
Dim Rownum As Integer
Dim Rowaddr As Integer
Dim Colnum As Integer
Dim Colladdr As Integer
Dim startcol As Integer
Dim startrow As Integer
Dim firstcell As Variant
Dim secondcell As Variant
Dim looprange As Integer
Rownum = Selection.Rows.Count
Rowaddr = Selection.Rows(Rownum).Row
Colnum = Selection.Columns.Count
Colladdr = Selection.Columns(Colnum).Column
startcol = (Colladdr - Colnum) + 1
startrow = (Rowaddr - Rownum) + 1
For looprange = 1 To Rownum
firstcell = Cells(startrow, startcol)
secondcell = Cells(startrow, Colladdr)
Cells(startrow, startcol) = secondcell
Cells(startrow, Colladdr) = firstcell
startrow = startrow + 1
Next
End Sub
this forum
I don't know if this is an efficient way of doing this but then again
I'm only a beginner so I have an excuse
Code:
--------------------
Public Sub swopcolumn()
Dim Rownum As Integer
Dim Rowaddr As Integer
Dim Colnum As Integer
Dim Colladdr As Integer
Dim startcol As Integer
Dim startrow As Integer
Dim firstcell As Variant
Dim secondcell As Variant
Dim looprange As Integer
Rownum = Selection.Rows.Count
Rowaddr = Selection.Rows(Rownum).Row
Colnum = Selection.Columns.Count
Colladdr = Selection.Columns(Colnum).Column
startcol = (Colladdr - Colnum) + 1
startrow = (Rowaddr - Rownum) + 1
For looprange = 1 To Rownum
firstcell = Cells(startrow, startcol)
secondcell = Cells(startrow, Colladdr)
Cells(startrow, startcol) = secondcell
Cells(startrow, Colladdr) = firstcell
startrow = startrow + 1
Next
End Sub