PC Review


Reply
Thread Tools Rate Thread

call a macro with arguments in a Command Button

 
 
=?Utf-8?B?SmVmZg==?=
Guest
Posts: n/a
 
      9th Nov 2006
1.) How do you call a macro with Cell value arguments in a Command Button on
Sheet1
which passes Cell A1 value, not cell A1 reference.
'Target' argument must pass A1 value

Problem is 'Target' passes back the cell reference not the value in the Cell.

Example
Public Sub Cmd_Services_Click(ByVal Target As CommandButton)
' A1 value is Supplies
'run code in Sheet1
ABC('Range("$A$1").Value) ????
End Sub

2.) In the properties window for command button, Name = Cmd_Services
Should it be Name - Cmd_Services(A1) ?
Cmd_Services(Sheet1!A1) ?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QURH?=
Guest
Posts: n/a
 
      9th Nov 2006
Hi

Try the below example

Public Sub tESTER2(MyCell As Range)
Dim rsp
rsp = MsgBox(MyCell.Value, vbOKOnly)
End Sub

In the immediate window type your range in the call to the Sub e.g.

tester2(Worksheets("Sheet4").cells(1,1))


--
Tony Green


"Jeff" wrote:

> 1.) How do you call a macro with Cell value arguments in a Command Button on
> Sheet1
> which passes Cell A1 value, not cell A1 reference.
> 'Target' argument must pass A1 value
>
> Problem is 'Target' passes back the cell reference not the value in the Cell.
>
> Example
> Public Sub Cmd_Services_Click(ByVal Target As CommandButton)
> ' A1 value is Supplies
> 'run code in Sheet1
> ABC('Range("$A$1").Value) ????
> End Sub
>
> 2.) In the properties window for command button, Name = Cmd_Services
> Should it be Name - Cmd_Services(A1) ?
> Cmd_Services(Sheet1!A1) ?
> .
> .
>
> I'm Frustrated
> --
> Jeff :-)
>
> --
> Jeff

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call SP from command button =?Utf-8?B?U3RldmVu?= Microsoft Access ADP SQL Server 4 14th Sep 2006 12:03 AM
Call sub with arguments from .onaction (command bar button) Andibevan Microsoft Access Form Coding 5 15th Feb 2006 05:36 PM
pass arguments to macro of excel file from command line poli Microsoft Excel Discussion 0 3rd Feb 2006 10:14 AM
call a macro from a command button? JR Microsoft Access Form Coding 2 10th Mar 2005 07:25 PM
call macro using command button mike Microsoft Access Forms 6 11th Nov 2003 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:04 PM.