Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Using variable sized range in CountIf()

Hi

Im trying to insert a formula at the bottom of set of data that has
just been inserted into a worksheet, the amount of data inserted can
vary everytime the program is run so the range will vary. Im using the
following code:

Dim rngFormula As Range
rngFormula = Range(Cells(5, 4), Cells(RowNum - 1, 4))
Worksheets("07_08 New Stores").Cells(RowNum, 4).Formula = "=COUNTIF("
& rngFormula & "," & """û""" & ")"

However, i get a "Type mismatch" error. Any ideas where im going
wrong?

Thanks for any suggestions
Paul

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default Using variable sized range in CountIf()

This should be better to set up your formula:

Dim rngFormula As String
rngFormula = Range(Cells(5, 4), Cells(RowNum-1, 4)).Address

James
wrote in message
oups.com...
Hi

Im trying to insert a formula at the bottom of set of data that has
just been inserted into a worksheet, the amount of data inserted can
vary everytime the program is run so the range will vary. Im using the
following code:

Dim rngFormula As Range
rngFormula = Range(Cells(5, 4), Cells(RowNum - 1, 4))
Worksheets("07_08 New Stores").Cells(RowNum, 4).Formula = "=COUNTIF("
& rngFormula & "," & """û""" & ")"

However, i get a "Type mismatch" error. Any ideas where im going
wrong?

Thanks for any suggestions
Paul


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
How to use VBA variable in COUNTIF function? terry Excel Worksheet Functions 10 November 19th 06 05:05 PM
Countif a Variable Cell Value Jack Excel Worksheet Functions 1 June 21st 06 10:05 AM
Summing a variably-sized range Titan Excel Worksheet Functions 1 August 26th 05 06:20 AM
countif variable criteria neda5 Excel Discussion (Misc queries) 3 May 3rd 05 10:55 AM
variable range countif JK Excel Worksheet Functions 3 November 3rd 04 07:50 AM


All times are GMT +1. The time now is 02:53 AM.

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"