Copy bold setting to other column

Romano_odK

Active Member
Joined
Jun 4, 2020
Messages
380
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

In the code below I would like to copy the bold value to the other column. Is that possible?

Thank you for your time.

VBA Code:
Private Sub CopyToVerkoopprijs_Click()
Worksheets("items").ListObjects("itemsimport").ListColumns(7).DataBodyRange.Font.Bold = True

Dim DRng As Range, CRng As Range
Dim DArr As Variant, CArr As Variant
With Sheets("Items")
        Set CRng = .Range(.ListObjects("ItemsImport").ListColumns(6).DataBodyRange.Address) 'Create write Range
        Set DRng = .Range(.ListObjects("ItemsImport").ListColumns(7).DataBodyRange.Address) 'Create read Range
               
        CArr = CRng.Value ' range to array
        DArr = DRng.Value ' range to array

        For i = LBound(CArr, 1) To UBound(CArr, 1)
            If Len(DArr(i, 1)) > 0 Then CArr(i, 1) = DArr(i, 1) ' if cell has more then 0 characters
        Next i

End With
CRng.Value = CArr ' Write values back to table
Worksheets("items").ListObjects("itemsimport").ListColumns(7).DataBodyRange.Font.Bold = False
'Range("H6:K15000").ClearContents

End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top