[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

VBA: Alter VBA script to find a range

Experts,

I have a script that will make changes to the entire sheet.  I am wanting to only have it apply the changes to only A5:AC30.

Can some help me modify my code?
Sub FormatChangerSurveillance()

Dim cell As Range

For Each cell In Sheets("NOC Agent Daily S").UsedRange
cell.Replace What:=":", Replacement:="."
cell.Replace What:="AM", Replacement:=" "
cell.Replace What:="PM", Replacement:=" "
Next

End Sub

Open in new window

0
Maliki Hassani
Asked:
Maliki Hassani
  • 2
1 Solution
 
Chris BottomleyCommented:
See below:

Chris
Sub FormatChangerSurveillance()

Dim cell As Range

For Each cell In Sheets("NOC Agent Daily S").Range("A5:AC30")
cell.Replace What:=":", Replacement:="."
cell.Replace What:="AM", Replacement:=" "
cell.Replace What:="PM", Replacement:=" "
Next

Open in new window

0
 
Chris BottomleyCommented:
Glad it helped

Chris
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now