Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default continued issue with countif function

hi all - many thanks to any reples its most appreciated although im still
having a few issues as my spreadsheet now has #NAME writen in many cells - my
code is as follows

Sub spot_duplicates()

Dim cell As Range
Dim counter As Integer

Sheets("Data").Select
Range("V4:V1443").Select

For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H&counter)"
Next counter

End Sub

--
C Ward
  #2   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default continued issue with countif function

You forgot some quotes:
Instead of:
For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H&counter)"
Next counter


For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H"&counter")"
Next counter

Look at the end of the line, need to end the H section add the counter
"Number" then end the formula with a parantheses between quotes.



"christopher ward" wrote:

hi all - many thanks to any reples its most appreciated although im still
having a few issues as my spreadsheet now has #NAME writen in many cells - my
code is as follows

Sub spot_duplicates()

Dim cell As Range
Dim counter As Integer

Sheets("Data").Select
Range("V4:V1443").Select

For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H&counter)"
Next counter

End Sub

--
C Ward

  #3   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default continued issue with countif function

Two additional things. I would discourage using the data type Integer for a
variable that is going to be used on rows in a worksheet. The maximum value
of Integer would not cover the maximum number of rows in any given worksheet.
If you look at the data type returned from Range.Rows you would see that it
is a LONG (Ie. long integer.)

2ndly, you do not NEED to select the range. At least for this snippet of
code. You may have some other reason to select it, but it is not required to
perform the actions you are doing.


"christopher ward" wrote:

hi all - many thanks to any reples its most appreciated although im still
having a few issues as my spreadsheet now has #NAME writen in many cells - my
code is as follows

Sub spot_duplicates()

Dim cell As Range
Dim counter As Integer

Sheets("Data").Select
Range("V4:V1443").Select

For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H&counter)"
Next counter

End Sub

--
C Ward

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default continued issue with countif function

You have more replies at your other thread.

christopher ward wrote:

hi all - many thanks to any reples its most appreciated although im still
having a few issues as my spreadsheet now has #NAME writen in many cells - my
code is as follows

Sub spot_duplicates()

Dim cell As Range
Dim counter As Integer

Sheets("Data").Select
Range("V4:V1443").Select

For counter = 4 To 1443
Range("V" & counter).Formula = "=IF(COUNTIF(H4:H1443,H4)=1,H&counter)"
Next counter

End Sub

--
C Ward


--

Dave Peterson
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
Countif function Issue justkar4u Excel Worksheet Functions 10 February 22nd 11 07:33 PM
COUNTIF Function issue Gweduc Excel Worksheet Functions 5 July 30th 09 10:43 PM
Countif issue Stuck Excel Worksheet Functions 3 June 23rd 09 10:29 PM
Excel Function . . . Continued Charlie Excel Discussion (Misc queries) 3 June 23rd 09 05:41 PM
issue with countif in vba Xavier Minet Excel Programming 2 July 30th 05 03:19 PM


All times are GMT +1. The time now is 03:24 PM.

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

About Us

"It's about Microsoft Excel"