#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Macro Help

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Help


Yes

Dim DeleteCol as string
Dim CompareStr as string
DeleteCol = "H"
CompareStr = Range("AY").Text
Call Duplicate_Delete(DeleteCol,CompareStr)


sub Duplicate_Delete(DeleteCol as string, CompareStr as String)
Application.WorksheetFunction.CountIf( _
Range(DeleteCol & "1:" & DeleteCol & x),CompareStr)
end sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=199734

http://www.thecodecage.com/forumz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro Help

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

Dim strCol As String
strCol = "H"

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

--
Jacob (MVP - Excel)


"fi.or.jp.de" wrote:

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
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Macro Help

Oops...I missed the point..Refer Joel's post

--
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

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

Dim strCol As String
strCol = "H"

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

--
Jacob (MVP - Excel)


"fi.or.jp.de" wrote:

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
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Macro Help

Joel, Thank u.

It works great


On Apr 30, 6:36*pm, joel wrote:
Yes

Dim DeleteCol as string
Dim CompareStr as string
DeleteCol = "H"
CompareStr = Range("AY").Text
Call Duplicate_Delete(DeleteCol,CompareStr)

sub Duplicate_Delete(DeleteCol as string, CompareStr as String)
Application.WorksheetFunction.CountIf( _
Range(DeleteCol & "1:" & DeleteCol & x),CompareStr)
end sub

--
joel
------------------------------------------------------------------------
joel's Profile:http://www.thecodecage.com/forumz/member.php?u=229
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=199734

http://www.thecodecage.com/forumz




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Macro Help

Joel,

Give me some tips to learn excel vba.

thanks for your help


On Apr 30, 6:36*pm, joel wrote:
Yes

Dim DeleteCol as string
Dim CompareStr as string
DeleteCol = "H"
CompareStr = Range("AY").Text
Call Duplicate_Delete(DeleteCol,CompareStr)

sub Duplicate_Delete(DeleteCol as string, CompareStr as String)
Application.WorksheetFunction.CountIf( _
Range(DeleteCol & "1:" & DeleteCol & x),CompareStr)
end sub

--
joel
------------------------------------------------------------------------
joel's Profile:http://www.thecodecage.com/forumz/member.php?u=229
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=199734

http://www.thecodecage.com/forumz


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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 03:50 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"