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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,224,852
Messages
6,181,405
Members
453,036
Latest member
Koyaanisqatsi

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