Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to run a macro in the background & how to end it?

I ran across a macro (see below) on this site by David McRitche which seems
to do what I want but, there are two things I would like the macro to do if
possible?
How can I edit this macro to do the following?

1. Have the macro run in the background. This macro ties up my cpu totally,
I can't doing anything until I stop it!!

2. Have the macro end when it see's the first blank cell in column "A" of
the master sheet. This macro just keeps running on, & on & on....

I have attempted to contact the author of this macro via email(no response)
that is why I have returned.. I'm not sure if its my three year old PC (P4)
or maybe the number of records I have but it seems to take a long time to
run. I am running Windows XP Pro and Office 2003.

I have a workbook that has two spreadsheets of data the master sheet (1) has
2,026 rows of data, the second sheet has 1,606 rows of data.
I want to compare the item number in column "A" in the master sheet against
the item number in column "A" in the second sheet.
The purpose is to identify the duplicate numbers between the two.
I am not a wiz at macros so any help would be greatly appreciated.

David McRitche's macro:

Sub FindDupes() 'assuming both sheets are in same book and book is open
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim cell1 As Range
Dim cell2 As Range
Dim str As String
str = InputBox("Type name of first sheet")
Set sht1 = Worksheets(str)
str = InputBox("Type name of second sheet")
Set sht2 = Worksheets(str)
For Each cell1 In sht1.Columns(1).Cells
For Each cell2 In sht2.Columns(1).Cells
If cell2.Value = cell1.Value Then
cell1.Interior.ColorIndex = 3
cell2.Interior.ColorIndex = 3
End If
Next cell2
Next cell1
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to run a macro in the background & how to end it?

VBA code is inherently synchronous.
Unless you employ some technique to extend this (may be with a timer), point
#1 is not possible.

#2
For Each cell1 In sht1.Columns(1).Cells
if cells1.value="" then exit sub
For Each cell2 In sht2.Columns(1).Cells

NickHK

"41db14" wrote in message
...
I ran across a macro (see below) on this site by David McRitche which

seems
to do what I want but, there are two things I would like the macro to do

if
possible?
How can I edit this macro to do the following?

1. Have the macro run in the background. This macro ties up my cpu

totally,
I can't doing anything until I stop it!!

2. Have the macro end when it see's the first blank cell in column "A" of
the master sheet. This macro just keeps running on, & on & on....

I have attempted to contact the author of this macro via email(no

response)
that is why I have returned.. I'm not sure if its my three year old PC

(P4)
or maybe the number of records I have but it seems to take a long time to
run. I am running Windows XP Pro and Office 2003.

I have a workbook that has two spreadsheets of data the master sheet (1)

has
2,026 rows of data, the second sheet has 1,606 rows of data.
I want to compare the item number in column "A" in the master sheet

against
the item number in column "A" in the second sheet.
The purpose is to identify the duplicate numbers between the two.
I am not a wiz at macros so any help would be greatly appreciated.

David McRitche's macro:

Sub FindDupes() 'assuming both sheets are in same book and book is open
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim cell1 As Range
Dim cell2 As Range
Dim str As String
str = InputBox("Type name of first sheet")
Set sht1 = Worksheets(str)
str = InputBox("Type name of second sheet")
Set sht2 = Worksheets(str)
For Each cell1 In sht1.Columns(1).Cells
For Each cell2 In sht2.Columns(1).Cells
If cell2.Value = cell1.Value Then
cell1.Interior.ColorIndex = 3
cell2.Interior.ColorIndex = 3
End If
Next cell2
Next cell1
End Sub



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 in Background Hager Excel Discussion (Misc queries) 2 January 19th 10 10:17 AM
How do I run a macro in the background scrumboss Excel Discussion (Misc queries) 2 April 6th 06 10:50 AM
Macro that runs in the background tomwashere2 Excel Discussion (Misc queries) 0 October 22nd 05 10:40 PM
Run macro in background Yohan Excel Programming 2 February 16th 04 11:38 AM
running macro at the background christine Excel Programming 1 January 3rd 04 02:39 AM


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