Quote:
Originally Posted by leuce
Thanks, your code works very well. I'm impressed by your forethought of telling the user that nothing is selected when nothing is selected.
I have realised in the mean time that such a macro needs at least two extra checks, namely (a) if the cell contains a formula or (b) if the cell is hidden, it should not add the cell reference.
==
I tweaked it bit, and here is what I came up with:
Sub AddTitle()
Dim Temp As Variant
Dim cell As Range
If TypeName(Selection) < "Range" Then
MsgBox "Select the range to work with.", vbCritical
Exit Sub
End If
For Each cell In Selection.Cells
If Not cell.Rows.Hidden Then
If Not cell.Columns.Hidden Then
If Not cell.HasFormula Then
If Not cell.Value = "" Then
Temp = cell.Value
cell.Value = "{{" & ActiveSheet.Name & "}}[[" & cell.Address(False, False, xlA1) & "]]" & Temp
End If
End If
End If
End If
Next cell
End Sub
==
Thanks again
Samuel (leuce)
|
Hi Samuel,
Great to know it's working for you.
Please let me know for any other Excel or VBA related issue you face in future.
Thank You,
Prashant