Fill Searched array with text

  • Thread starter Thread starter terryspencer2003
  • Start date Start date
T

terryspencer2003

I am trying to fill in the word "Blank" across a row array with data
already in it. I want all the cells in teh array to say "blank".

I want to select a cell, then highlight all the data including the
selected cell to the right (i.e. shift/cntrl right arrow). Then I
want to count the number of columns included in the array and assign
that number to a variable.

I am trying this but it doesn't work:

Dim ColumnCount As Integer


Range("DropDownStartCell").Select
Range(Selection, Selection.End(xlToRight)).Select
ColumnCount = ActiveRange.Column.Count

For X = 1 To ColumnCount
Range("DropDownStartCell").Select.Offset(0, X) = "Blank"

Next X


End Sub

Any ideas
 
I'm assuming that "DropDownStartCell" is a named range,

Dim rngDDSC as Range

Set rngDDSC = Range("DropDownStartCell")
Range(rngDDSC , rngDDSC .End(xlToRight)).Value = "Blank"

HTH
Paul
 
IfDropDownStartCell were Cell D3 and you had data in D3:H3, what cells
do you want to contain "Blank"? In particular, do you want Cell D3 to
contain "Blank"? Your attempted loop starts with the cell offset 1 cell
to the right.

In any event, you will have better luck if you use something like

Set rng = Range("DropDownStartCell")
Set DataRange = Range(rng, rng.End(xlToRight))
Range(DataRange(1, 2), DataRange(1, DataRange.Count)).Value = "Blank"

This will not enter "Blank" in "DropDownStartCell"; if you want that,
change the 2 to 1.

Alan Beban
 
Back
Top