If I try to execute a macro whit the procedure header being like this: Sub test (Byval Target As Range)
it doesn't work, instead a new window called Macros comes up.
I have tried older codes that I have saved in a .txt and that I know worked befor but it's still the same problem.
It is not a problem when im trying to run macros like: Sub test()
Sub test() 'Works
Sub test (Byval Target As Range) 'Doesn't Work
I am new to VBA and fairly new to Excel tbh, so i did not know where to turn.
Last edited by Timestamp; 01-24-2012 at 05:57 AM.
do you mean like this?
Sub Test() rangeTest Sheet1.Cells(2, 1) End Sub Sub rangeTest(ByRef rng As Range) Dim o As Range For Each o In rng MsgBox o.value Next End Sub
Click the * below to say thanks
Girls sleep with guys who use photoshop, but marry the ones who work with Excel
Corduroy pillows: They're making headlines!
Did you mean: recursion
http://www.google.com/search?hl=en&q=recursion
You cannot run a macro that requires a range argument from the macros dialog, if that is what you are attempting, because you have no way to pass that range to it from the dialog.
Good luck.
What I mean is, if I do a macro like this:
Private sub Worksheets_change(ByVal Target As range)
Application.EnableEvents = False
Range("A1").Value = Target.Value
Application.EnableEvents = True
or
Function nExists(FindName As string) As boolean
Dim Rng as Range
Dim myName as String
On Error Resume Next
myName = ActiveWorkbook.Names(FindName).Name
If Err.Number = 0 then
NameExists = True
Else
NameExists = False
End If
End Function
I Can't write any code that needs text inside the "()".
Hope you understand, dont know how else to explain it.
How are you trying to call/execute these macros?
Click the * below to say thanks
Girls sleep with guys who use photoshop, but marry the ones who work with Excel
Corduroy pillows: They're making headlines!
Did you mean: recursion
http://www.google.com/search?hl=en&q=recursion
Yee thanks Kyle123, thats it.
The memory is good but short.
Here i been spaming F5
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks