I'm getting a compile error . Expected End Sub ??

MikeyZ

Well-known Member
Joined
Mar 14, 2002
Messages
553
Can anyone help on this? I don't know what to look for to fix.


Application.Goto Reference:="R6C29"
Sub MG10Oct01()
Dim rng As Range, Dn As Range, Sp As Variant, n As Long, c As Long
Set rng = Range(Range("Z1"), Range("Z" & Rows.Count).End(xlUp))
Application.ScreenUpdating = False
For Each Dn In rng
For n = 1 To Len(Dn.Value)
If Dn.Characters(n, 6).Text = "530ZBA" Then
Dn.Characters(n, 6).Font.Color = vbRed
End If
Next n
Next Dn
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

Looks like this line of code :

Application.Goto Reference:="R6C29"

isn't between the Sub and End Sub.
Try this :

Code:
Sub MG10Oct01()
Application.Goto Reference:="R6C29"
 Dim rng As Range, Dn As Range, Sp As Variant, n As Long, c As Long
 Set rng =Range("Z1:Z" & Range("Z1").End(xlDown).Row)
 Application.ScreenUpdating = False
 For Each Dn In rng
   For n = 1 To Len(Dn.Value)
        If Dn.Characters(n, 6).Text = "530ZBA" Then
            Dn.Characters(n, 6).Font.Color = vbRed
        End If
   Next n
 Next Dn
 Application.ScreenUpdating = True
 End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,582
Messages
6,125,660
Members
449,247
Latest member
wingedshoes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top