Lower case VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can can I adjust the program below to:
Sheets("Sheet1").Select
cell = Columns("A:A").Select

'***PROGRAM START*******
Sub ChangeFromUpperToLowerCase()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If Not cell.HasFormula Then
cell.Value = LCase(cell.Value)
End If
Next cell
End Sub
'***PROGRAM END*******

Thanks in advance.
Maperalia
 
this should work from anywhere in the workbook. Best NOT to use a whole
column.

Sub lowerit()
For Each c In Sheets("sheet1") _
..Range("a1:a" & Cells(Rows.Count, "a").End(xlUp).Row)
c.Value = LCase(c)
Next c
End Sub
 
I would recommend agains the select myself you can do something like this...

Sub ChangeFromUpperToLowerCase()
Dim rngToChange as Range
Dim cell As Range

with sheets("Sheet1")
set rngToChange = .range(.Range("A1"), .cells(rows.count,
"A").end(xlUp))
end with
For Each cell In rngToChange
If Not cell.HasFormula Then
cell.Value = LCase(cell.Value)
End If
Next cell
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top