Macros

JamesPW

Board Regular
Joined
Nov 4, 2005
Messages
52
Office Version
  1. 2019
Platform
  1. MacOS
Why does this macro not appear in my macro list? I'm aware that if it has "parameters" it won't appear but I don't what parameters are. If this is the reason, what parts of my code are parameters? Thanks

Private Sub Button298_click()

Dim i As Integer

For i = 3 To 14

If Range(Cells(27, i), Cells(27, i)).Font.Color <> vbBlack Then
Cells(28, i).Value = 0
Else
Cells(28, i).Value = 1
End If
Cells(28, i).Font.Color = Cells(27, i).Font.Color
Next i
MsgBox "Update Complete"

End
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
The macro won't appear in the macro list if it is placed in the code module for the worksheet or in a code module in a userform.
 
Upvote 0
That code won't appear in the macro list because it starts with the word "Private"
The Parameters (when they exist) appear in the () after the sub name.
 
Upvote 0
The macro won't appear in the macro list if it is placed in the code module for the worksheet or in a code module in a userform.

Thanks for the quick response. As you can see I know enough about macros to get me into trouble.
I'm not sure what "code module" or "Userform" is.
The macro is in Module1. Is this a "code Module"?.
VBA Projects (filename)
Sheet1 (tabname)
Sheet2 (tabname)
Modules
Module1

Button298 is on Sheet 2. If I move the macro to Button298 will it appear?

Thanks again
 
Upvote 0
Explaining the various types of modules and how and when to use them would take considerable time. I think that it may be appropriate for you to do a some research on the topic. This link could perhaps provide you with a start: http://www.cpearson.com/excel/codemods.htm
 
Upvote 0
Thanks for the quick response. As you can see I know enough about macros to get me into trouble.
I'm not sure what "code module" or "Userform" is.
The macro is in Module1. Is this a "code Module"?.
VBA Projects (filename)
Sheet1 (tabname)
Sheet2 (tabname)
Modules
Module1

Button298 is on Sheet 2. If I move the macro to Button298 will it appear?

Thanks again

Check out post number 3. As Fluff says the reason it isn't visible is it is marked 'Private' if you marked it as public then it would be visible. Your sub doesn't contain any parameters

So this should be visible when stored in a module:

Code:
[B][COLOR=#ff0000]Public[/COLOR][/B][COLOR=#333333] Sub Button298_click()
[/COLOR]

[COLOR=#333333]Dim i As Integer[/COLOR]

[COLOR=#333333]For i = 3 To 14[/COLOR]

[COLOR=#333333]If Range(Cells(27, i), Cells(27, i)).Font.Color <> vbBlack Then[/COLOR]
[COLOR=#333333]Cells(28, i).Value = 0 [/COLOR]
[COLOR=#333333]Else[/COLOR]
[COLOR=#333333]Cells(28, i).Value = 1[/COLOR]
[COLOR=#333333]End If [/COLOR]
[COLOR=#333333]Cells(28, i).Font.Color = Cells(27, i).Font.Color[/COLOR]
[COLOR=#333333]Next i[/COLOR]
[COLOR=#333333]MsgBox "Update Complete"[/COLOR]

[COLOR=#333333]End[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Upvote 0
Why does this macro not appear in my macro list? I'm aware that if it has "parameters" it won't appear but I don't what parameters are. If this is the reason, what parts of my code are parameters? Thanks

Private Sub Button298_click()

Dim i As Integer

For i = 3 To 14

If Range(Cells(27, i), Cells(27, i)).Font.Color <> vbBlack Then
Cells(28, i).Value = 0
Else
Cells(28, i).Value = 1
End If
Cells(28, i).Font.Color = Cells(27, i).Font.Color
Next i
MsgBox "Update Complete"

End
End Sub

Thanks to all
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,629
Members
452,661
Latest member
Nonhle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top