Gadget
01-25-2008, 04:10 AM
This is bugging me: the following code does what it says on the tin - it duplicates the current row.
Only thing is that a couple of the columns in the source row it duplicates are in currency format (with the symbol left aligned in the cell) and the duplicated column formats the currency within the symbol pushed left against the text.
Is there an easy/quick way to do it? Do I have to go through every cell?
Private Sub BtnDuplicate_Click()
Dim RowNum As Long
Dim RngThisRow, RngDupRow As Range
RowNum = ActiveCell.Row
Range("A" & (RowNum + 1)).EntireRow.Insert
Set RngThisRow = Range("B" & RowNum & ":R" & RowNum)
Set RngDupRow = Range("B" & (RowNum + 1) & ":R" & (RowNum + 1))
RngDupRow.Value = RngThisRow.Value
End Sub
Only thing is that a couple of the columns in the source row it duplicates are in currency format (with the symbol left aligned in the cell) and the duplicated column formats the currency within the symbol pushed left against the text.
Is there an easy/quick way to do it? Do I have to go through every cell?
Private Sub BtnDuplicate_Click()
Dim RowNum As Long
Dim RngThisRow, RngDupRow As Range
RowNum = ActiveCell.Row
Range("A" & (RowNum + 1)).EntireRow.Insert
Set RngThisRow = Range("B" & RowNum & ":R" & RowNum)
Set RngDupRow = Range("B" & (RowNum + 1) & ":R" & (RowNum + 1))
RngDupRow.Value = RngThisRow.Value
End Sub