Hi,
I have a different excel spreadsheets which I must convert to PROPER case
My difficulty is that have two macros that seem work individually and I am wondering how I can combine both and if this is possible.
Firstly I am using the following to select the 'range' of values
Sub SelectDataRange()
Dim LastRow As Long, LastColumn As Long
LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).<wbr>Row
LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).<wbr>Column
Range("A1").Resize(LastRow, LastColumn).Select
MsgBox "The data range address is " & Selection.Address(0, 0) & ".", 64, "Data-containing range address:"
End Sub
and then secondly I hope to use something like this to change the selected range to proper case but I new to this and really struggling with the following and also with combining both
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula = False Then
cell = Application.Proper(cell)
End If
Next
I have also tried the following but only experimented by using a defined range so it isn't of much use to me.
Sub Proper_Case()
For Each x In Range("C1:C5")
x.Value = Application.Proper(x.Value)
Next
End Sub
Any help would be greatly appreciated.
Thank you
I have a different excel spreadsheets which I must convert to PROPER case
My difficulty is that have two macros that seem work individually and I am wondering how I can combine both and if this is possible.
Firstly I am using the following to select the 'range' of values
Sub SelectDataRange()
Dim LastRow As Long, LastColumn As Long
LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).<wbr>Row
LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).<wbr>Column
Range("A1").Resize(LastRow, LastColumn).Select
MsgBox "The data range address is " & Selection.Address(0, 0) & ".", 64, "Data-containing range address:"
End Sub
and then secondly I hope to use something like this to change the selected range to proper case but I new to this and really struggling with the following and also with combining both
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula = False Then
cell = Application.Proper(cell)
End If
Next
I have also tried the following but only experimented by using a defined range so it isn't of much use to me.
Sub Proper_Case()
For Each x In Range("C1:C5")
x.Value = Application.Proper(x.Value)
Next
End Sub
Any help would be greatly appreciated.
Thank you