Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Excel macros

I am running these two macros on a spreadsheet designed for label
merging with Word - using Office 2003, Win XP Pro

The macros run just fine and do what is expected, but what happens is
that when I run the macro, it immediately shows the file in proper
case, then the pointer/hourglass vibrates for a few seconds as if some
processing is being accomplished, then the second macro shows itself
as completed, again almost instantaneously.

My question is what is going on during the processing, is the program
writing all the changes after it shows them, or what? I'm simply
curious because the more I know what is happening the better I
understand the coding in vba.

Here is the coding for the macros:

Public Sub ProperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = StrConv(Rng.Value, vbProperCase)
End If
Next Rng
Call FixStates
End Sub

Public Sub FixStates()
Cells.Replace What:=" Il ", Replacement:=" IL ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:=" Mn ", Replacement:=" MN ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

One more question Please. I can't figure out how to put buttons on my
command bar for these two macros - not as straight forward as it is in
Word. Could you please direct me to an article explaining the
procedure.

Thanks a million
Joanne

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Excel macros

Joanne,

Add this to the top of you code:

With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
.DisplayAlerts = False
End With

and this to the bottom

With Application
.ScreenUpdating = True
.EnableEvents = True
.DisplayAlerts = True
.Calculation = xlCalculationAutomatic
End With

As for adding the button, put your code into your Personal.xls, then visit:

http://www.mvps.org/dmcritchie/excel/toolbars.htm

and look for

"Add or delete a toolbar button"

HTH,
Bernie
MS Excel MVP


"Joanne" wrote in message ...
I am running these two macros on a spreadsheet designed for label
merging with Word - using Office 2003, Win XP Pro

The macros run just fine and do what is expected, but what happens is
that when I run the macro, it immediately shows the file in proper
case, then the pointer/hourglass vibrates for a few seconds as if some
processing is being accomplished, then the second macro shows itself
as completed, again almost instantaneously.

My question is what is going on during the processing, is the program
writing all the changes after it shows them, or what? I'm simply
curious because the more I know what is happening the better I
understand the coding in vba.

Here is the coding for the macros:

Public Sub ProperCase()
Dim Rng As Range
For Each Rng In Selection.Cells
If Rng.HasFormula = False Then
Rng.Value = StrConv(Rng.Value, vbProperCase)
End If
Next Rng
Call FixStates
End Sub

Public Sub FixStates()
Cells.Replace What:=" Il ", Replacement:=" IL ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:=" Mn ", Replacement:=" MN ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

One more question Please. I can't figure out how to put buttons on my
command bar for these two macros - not as straight forward as it is in
Word. Could you please direct me to an article explaining the
procedure.

Thanks a million
Joanne



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
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
convert lotus 123w macros to excel macros rpiescik[_2_] Excel Programming 1 September 19th 04 12:41 PM
convert lotus 123w macros to excel macros rpiescik Excel Programming 1 September 18th 04 01:35 PM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM


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