NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,275
- Office Version
- 2016
- 2010
- Platform
- Windows
Good afternoon,
Quick query for a rush job - I need to write a procedure which, when I select a range of cells, and then run the procedure, all the cells' values will equal the value in the first cell. I did this:
but Excel reports that "For Each contol variable mus be variant or object"Where am I going wrong, & thanks in advance!
Quick query for a rush job - I need to write a procedure which, when I select a range of cells, and then run the procedure, all the cells' values will equal the value in the first cell. I did this:
Code:
Sub PopulateAll()
Dim SelectedCell(1 To 100) As Variant
For Each SelectedCell In Selection
SelectedCell.Value = SelectedCell(1).Value
Next
End Sub
but Excel reports that "For Each contol variable mus be variant or object"Where am I going wrong, & thanks in advance!