Macro Help

F

fi.or.jp.de

Hi All,

I have calling some macro like this

Call Duplicate_Delete

The Macro "Duplicate_Delete" deletes the col A's duplicate data
using Countif function.

Once this done again my main macro does some activity

Again i need to run the Duplicate_Delete macro for the Col H.

but previous i coded as
Application.WorksheetFunction.CountIf(Range("A1:A" & x),
Range("AY").Text).

So, i need to run the same code for Col H.

I know, i need to create new macro which hardly contains 3 lines.

Is there any option i can assign it as follows

Application.WorksheetFunction.CountIf(Range(ColA & "1:" & ColA & x),
Range("AY").Text).

Eg.,

Cola = "A"
Call Duplicate_Delete

''
do other work

''

Cola = "H"
Call Duplicate_Delete

Thanks in advance
 
J

Jacob Skaria

Try the below. Do you mean Range("AY").Text) ?

Dim strCol As String
strCol = "H"

varCount = Application.WorksheetFunction. _
CountIf(Columns(strCol), Range("A1").Text)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top