Macro Create Array of Rows and Delete

mkron

New Member
Joined
Apr 5, 2017
Messages
18
Hello,

I am trying to create a macro where it gives the bold value to all of the non bold cells beneath it.
I also want to delete the bold rows but have not been successful

Here is the code for the cell values which works.
Code:
    For Each cCell In Range("A" & "2" & ":A" & spot)
        If cCell.Font.Bold = True Then
            boldcell = cCell.Value
        Else: cCell.Value = boldcell
        End If
    custrow = custrow + 1
    Next

I believe I can do something like this but with rows but I do not know how to create an array of rows in a loop.
Code:
    Dim X As Long, ColsToDelete As Variant
    ColsToDelete = Split("B C D E G H I J K L M N O P Q R S T V X Z AA AB AD AF AH AI AJ AL AM AN AP AR AT AV AX AY")
    Application.ScreenUpdating = False
    For X = UBound(ColsToDelete) To 0 Step -1
        Columns(ColsToDelete(X)).Delete
    Next

Any help will be much appreciated.
Thanks in advance!
-MK
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
find out using len() number of spaces (or firstly decrease number of cols and manually type how much spases are there) then redim array and use split:
Code:
redim colstodelete(0 to numberofspaces)
for i = 0 to NumberOfSpaces
colstodelete(i)= split(....)(i)
next i
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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