View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default A dialog box to change Columns

hi
try adding this after your Dim's...
Dim myR As String
myR = InputBox("Enter a range")

change this line from Range("D5"D500") to Range(myR)
For Each myC In Intersect(ActiveSheet.UsedRange, Range(myR))

regards
FSt1


"Steved" wrote:

Hello from Steved

Is it possible please to change Range("D5:D500")) to say Range("AA5:AA500"))

I've got different columns so I would like to please a Dailog box to come up
when I press the Icon on my Ribbon to ask what column is reqired, for example
Column B

Sub Test()
Dim myS As String
Dim myC As Range

For Each myC In Intersect(ActiveSheet.UsedRange, Range("D5:D500"))
myS = myC.Value
myC.NumberFormat = "@"
myC.Value = myS
If Len(myC.Value) < 4 And myC.Value "" Then
Do Until Len(myC.Value) = 4
myC.Value = "0" & myC.Value
Loop
End If
With myC.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Underline = xlUnderlineStyleSingle
.COLOR = 255
End With
Next myC
End Sub

Thankyou.