Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro assignment to button gets reassigned

can you show the code originally assigned to the button so we can check it?

"Rob" wrote in message
...
Very bizzare behaviour. I have a button with a macro (VBA
Procedure I had written) assigned to it. For some unknown
reason, the assinged macro has changed and now references
a Named Reference! And in some cells I use the vlookup
function with a Named Reference, it replaced that Named
Reference with a VBA Procedure I had written.

Any idea what is going on here? I have Excel 2000,
9.0.2720.

Thanks!

Rob




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro assignment to button gets reassigned

John,

In the spreadsheet I had every use of a Named Reference
and every macro/VBA assignment get changed. In some cases
where I had referenced a VBA Proc, it got replaced with a
Named Reference!

An example of one change was where one Named Ref got
swapped with another:
I had a vlookup that originally had:
=VLOOKUP(A2,HourDetail,17,FALSE)

But it got changed to:
=VLOOKUP(A2,LunchHours,17,FALSE)
where LunchHours was a different named reference.

In another case, I had code to freeze values on a
spreadsheet get changed to another procedure. In that
case, the original code (ClearLunch) was changed to
(SetWorksheet). The code for both is shown below.

Thanks for taking the time to look at this.

Rob

Sub ClearLunch()
Dim iAnswer, iNumrows As Integer
Dim sAreYouSure, sFirstRegionEnd, sSecondRegionEnd As
String
sAreYouSure = "Are you sure you want to clear the
lunch values?"
iAnswer = MsgBox(sAreYouSure, vbYesNo, "Confirm")
If iAnswer = vbYes Then
ActiveSheet.Unprotect
iNumrows = Range("A1").CurrentRegion.Rows.Count
sFirstRegionEnd = "G" & iNumrows
Range("C4", sFirstRegionEnd).ClearContents
sSecondRegionEnd = "M" & iNumrows
Range("I4", sSecondRegionEnd).ClearContents
ActiveSheet.Protect
End If
End Sub

Sub SetWorksheet()
Dim sAreYouSure As String
Dim iAnswer As Integer
'This procedure will convert all formulas to their
values.
'Get the name of the sheet, then confirm with the user
that they are
'about to freeze the calculated values on the payroll
worksheet.
ActiveSheet.Unprotect
Cells.Select
sAreYouSure = "Are you sure you want to freeze the
cacluated values on this payroll sheet?"
iAnswer = MsgBox(sAreYouSure, vbYesNo, "Confirm")
If iAnswer = vbYes Then
Selection.Copy
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
ActiveSheet.Protect
Application.CutCopyMode = False
Range("A1").Select
End Sub
-----Original Message-----
can you show the code originally assigned to the button

so we can check it?

"Rob" wrote in message
...
Very bizzare behaviour. I have a button with a macro

(VBA
Procedure I had written) assigned to it. For some

unknown
reason, the assinged macro has changed and now

references
a Named Reference! And in some cells I use the vlookup
function with a Named Reference, it replaced that Named
Reference with a VBA Procedure I had written.

Any idea what is going on here? I have Excel 2000,
9.0.2720.

Thanks!

Rob




.

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
Use Macro To Change Which Macro Assigned To Command Button CVinje Excel Discussion (Misc queries) 0 May 25th 10 09:55 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM
Crtl+Z reassigned by muppet - cannot find to fix [email protected] Excel Discussion (Misc queries) 2 September 18th 06 01:40 PM
use macro button to run macro in protected sheet earl Excel Discussion (Misc queries) 3 February 26th 06 10:21 PM
Command Button Assignment Bill Martin Excel Discussion (Misc queries) 2 January 1st 06 02:50 AM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"