L
Legacy 227120
Guest
I am new to VBA and am trying to get one to work. I have copied one from a forum and I'm pretty sure it will do what I require. The code is as follows:
Sub test()
Do
myRange.Replace What:=" ", Replacement:=" ", LookAt:=xlPart
Loop Until Application.CountIf(myRange, "* *") = 0
End Sub
However when I test it, an error comes up: "Run-time error 424: Object required". When I debug it highlights the following line (underlined above). I'm pretty sure its an easy fix, however being new to VBA its quite difficult for me!
Any help would be appreciated.
Sub test()
Do
myRange.Replace What:=" ", Replacement:=" ", LookAt:=xlPart
Loop Until Application.CountIf(myRange, "* *") = 0
End Sub
However when I test it, an error comes up: "Run-time error 424: Object required". When I debug it highlights the following line (underlined above). I'm pretty sure its an easy fix, however being new to VBA its quite difficult for me!
Any help would be appreciated.