Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA - Action if a cell holds a certain value?

Hi hibatt,

A few things (which doesn't necessarily make an error)
- you haven't declared c, Dim c as Range
- working with row numbers, it is better to use Long variable instead of Integer because there are 64K+ row an Integer could come short.
- look at the Value or Text properties of a cell to see what's in there.
- use the InStr() function to search a substring with a string.
- no need to select a cell to write into it.

Sub Copy()
Dim c as Range
Dim Store As Integer

Store = 0

For Each c In Worksheets("SPARE9").Range("O11:O92").Cells
If InStr(1,c.Text,"x", vbTextCompare) 0 Then Store = Store +1
Next

Range("A1").Value= Store

End Sub


Regards,
Sebastien
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
2007: xlsm format holds how many columns? Zahra Excel Discussion (Misc queries) 4 February 6th 09 12:27 AM
How to make Same formula over multiple rows but still holds row # BallySuperTech Excel Worksheet Functions 1 March 15th 08 06:49 PM
how can I customise a toolbar with a tag that holds macros Drewb Charts and Charting in Excel 0 June 5th 06 04:30 PM
How do I create a footnote for a cell that holds a SUM function . green opal Excel Discussion (Misc queries) 1 June 10th 05 01:39 PM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"