VBA Code to apply to certain cells

Brass Contributor

How do I apply this code only to certain cells, not the whole worksheet

jaolvera_0-1692207637918.png

 

5 Replies

@jaolvera 

In the line

Set xRgVal = Cells.SpecoalCells(xlCellTypeAllValidation)

change Cells to the range you want to limit it to, for example

Set xRgVal = Range("D2:D100").SpecoalCells(xlCellTypeAllValidation)

Thank you! this error popped up when I go to enter data into the cells after@Hans Vogelaar 

jaolvera_0-1692217387158.png

 

@jaolvera 

You forgot the quotes around the range address - see my previous reply for an example.

I just added the quotes and the same error is populating
nevermind it worked