AmeliaBedelia
New Member
- Joined
- Apr 8, 2018
- Messages
- 19
Hello,
I am using a looping code that copies information from a source range to a destination range. It does not use copy and paste, but uses the code "DestRange.Value = smallrng.Value" It places the value, but does not retain any of the Font formatting (bold, underline, colors of font). I would like to know if there is a way to alter this code so that it copies the font formatting from the source range to the destination range. Or if there are any other suggestions for code that would complete the same function.
Here is a copy of the entire code:
Sheets("Form").Select
'Set the source range to "Comments" - a named range set to grab data from G1, D1, G2, G3, G4 on the Form sheet
Set SourceRange = Sheets("Sheet1").Range("Comments")
'Select Comments Sheet
Sheets("Comments").Select
'Find InsertComments - named range in first empty row in column A, it moves down as rows are inserted to always stay at bottom
Application.GoTo Reference:="InsertComments"
'Insert a row
Selection.EntireRow.Insert
'Set the destination to comments sheet
Set DestSheet = Sheets("Comments")
'Look for first empty row starting in Column A
lr = DestSheet.Cells(Rows.Count, "A").End(xlUp).Row
i = 1
'This now pastes the data into the columns in the same order as we specified in our named range
For Each smallrng In SourceRange.Areas
'We make DestRange the same size as smallrng and use the value property to give DestRange the same values
With smallrng
Set DestRange = DestSheet.Cells(lr + 1, i) _
.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = smallrng.Value
i = i + smallrng.Columns.Count
'It now loops up to the next smallrng until all the specified cells in our named range have been copied over and then moves on
Next smallrng
I am using a looping code that copies information from a source range to a destination range. It does not use copy and paste, but uses the code "DestRange.Value = smallrng.Value" It places the value, but does not retain any of the Font formatting (bold, underline, colors of font). I would like to know if there is a way to alter this code so that it copies the font formatting from the source range to the destination range. Or if there are any other suggestions for code that would complete the same function.
Here is a copy of the entire code:
Sheets("Form").Select
'Set the source range to "Comments" - a named range set to grab data from G1, D1, G2, G3, G4 on the Form sheet
Set SourceRange = Sheets("Sheet1").Range("Comments")
'Select Comments Sheet
Sheets("Comments").Select
'Find InsertComments - named range in first empty row in column A, it moves down as rows are inserted to always stay at bottom
Application.GoTo Reference:="InsertComments"
'Insert a row
Selection.EntireRow.Insert
'Set the destination to comments sheet
Set DestSheet = Sheets("Comments")
'Look for first empty row starting in Column A
lr = DestSheet.Cells(Rows.Count, "A").End(xlUp).Row
i = 1
'This now pastes the data into the columns in the same order as we specified in our named range
For Each smallrng In SourceRange.Areas
'We make DestRange the same size as smallrng and use the value property to give DestRange the same values
With smallrng
Set DestRange = DestSheet.Cells(lr + 1, i) _
.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = smallrng.Value
i = i + smallrng.Columns.Count
'It now loops up to the next smallrng until all the specified cells in our named range have been copied over and then moves on
Next smallrng