VBA if statement only on cells that contain a formula starting with "c:\"

mountainman88

Board Regular
Joined
Jun 22, 2019
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
I have some code that appears to be running pretty well, part of the code loops through every cell in a usedrange and replaces the formula in the cell based on an IF statement. I need the IF statement to be true when the formula text of the cells in the usedrange starts with C:\

I have seen some approaches where a custom function is created and called, and if your solution has this and it's the only option that's fine, but I was wondering if the is a solution that doesn't call a function?

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
It would be helpful to show the code you are using. It is not really clear what is in the cells but I took your description completely literally:
VBA Code:
Dim Cell As Range
For Each Cell In UsedRange

   If Left(Cell.Formula,3) = "=C:\" Then
      ' Do what you want to do
   End If

Next Cell
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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