didijaba
Well-known Member
- Joined
- Nov 26, 2006
- Messages
- 511
Hi, I have plenty of cells with data validations formulas, all in absolute format ($A$1). Do you know how to convert them to A1 format? I have tried with add validation, but didn't work.
Code:
Sub RELATIVE_REFERENCE()
Dim x As Range
On Error Resume Next
Selection.Offset(0, 5).Value = Right(Selection.Validation.Formula1, Len(Selection.Validation.Formula1) - 1)
Selection.Offset(0, 5).Value = Application.WorksheetFunction.Substitute(Selection.Offset(0, 5).Text, "$", "")
x = Selection.Offset(0, 5)
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(" & x & ")"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
'.Formula = Application.ConvertFormula(Formula:=ActiveCell.Offset(0, 5).Value, fromReferenceStyle:=xlA1, ToReferenceStyle:=xlA1, ToAbsolute:=xlRelRowAbsColumn)
End Sub