ADD Text to Cell Value // FILTERED Selection

NEW_2VBA

Board Regular
Joined
Dec 15, 2015
Messages
103
Hello! I'm sure this is an easy fix but I can't figure out how to change the code below to apply to visible cells only if user has selected cells within a filtered list.
It currently works however it updates all cells within a selected range, even cells not visible in a filtered list.

đź›  I tried a few things (like adding SpecialCells(xlCellTypeVisible).Value) but it backfired & updated every cell in my workbook o_O (luckily it was a test workbook) lol! :LOL:


Dim c As Range
For Each c In Selection
If c.Value <> "" Then c.Value = "T&M to support unit costs: " & c.Value
Next

Thank you for your insight! đź‘€
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
64,052
Office Version
  1. 365
Platform
  1. Windows
Try
VBA Code:
 For Each c In Selection.SpecialCells(xlVisible)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
64,052
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,144,524
Messages
5,724,839
Members
422,583
Latest member
neomilan

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
Top