You are here:

Excel/VBA Excel Filter range

Advertisement


Question
Hi Aidan
I have a spreadsheet which am writing VBA code for.  I have filtered my data on one column for a particular criteria and have been able to copy of delete the visible rows successfully.  However, I now want to change one particular cell's text in all the visible rows (that have met my criteria.  Can you help please?

Answer
As you already have the criteria, you can ignore the filter - for each cell in the range
if it matches the criteria
carry out the action
next

so for example
for each cl in range("a1:a200")
if cl.value=2 then
cl.offset(0,1).value="True"
end if
next

would set the value of column B to True for any cells in the range that were a value of 2 - a little simplistic, but hopefully gives you what you want to know!
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Aidan Heritage

Expertise

I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!

Experience

My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

Education/Credentials
I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2016 About.com. All rights reserved.