Hello,
Right now I have a bunch of cells in a table with certain data validation properties. All of the cells of a particular column in the table have the same properties. My issue is, the whole table minus the header gets deleted then restored in my VB code. When this happens, the restored cells no longer have the validation properties they need. So what I was thinking was to take the validation properties of the headers of each table column, and extend them to the entire column (because the header of the table never loses it's validation properties). So my code looks like this:
The problem is the line:
This line does not work at all and I knew it wouldn't, but I can't find anywhere what to replace it with. Thanks in advance!
Right now I have a bunch of cells in a table with certain data validation properties. All of the cells of a particular column in the table have the same properties. My issue is, the whole table minus the header gets deleted then restored in my VB code. When this happens, the restored cells no longer have the validation properties they need. So what I was thinking was to take the validation properties of the headers of each table column, and extend them to the entire column (because the header of the table never loses it's validation properties). So my code looks like this:
Code:
Dim upperLeftC As Long
Dim upperLeftR As Long
Dim rowC As Long
rowC = Sheet1.ListObjects(1).ListColumns.Count
upperLeftC = Range(Sheet1.ListObjects(1).Range.Cells(1).Address(0, 0)).Column
upperLeftR = Range(Sheet1.ListObjects(1).Range.Cells(1).Address(0, 0)).Row
Dim counter As Long
For counter = upperLeftC To upperLeftC + rowC - 1
Columns(counter).Select
Selection.Validation = Sheet1.Cells(upperLeftR, counter).Validation
Next counter
End Sub
The problem is the line:
Code:
Selection.Validation = Sheet1.Cells(upperLeftR, counter).Validation
This line does not work at all and I knew it wouldn't, but I can't find anywhere what to replace it with. Thanks in advance!