Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default assigning a macro to a cell?


Can I do the following. I am a novice in VBA. I will try to explain t
the best of my ability.

In Sheet1

I want the code to start in J2 and search down all of the column unti
J200. If it finds the words NEED TO PAY, then put a command button o
anything that can run an assigned macro in the corresponding colum
(K). So if the loop or code finds the words NEED TO PAY in J10 i
would put a button or someting in K10 that would run a macro(have th
ability to run a macro, don't run now), only if it is clicked.

Any help would be wonderful,

please let me know, I probably didn't explain very well

Thanks
jos

--
jhahe
-----------------------------------------------------------------------
jhahes's Profile: http://www.excelforum.com/member.php...fo&userid=2359
View this thread: http://www.excelforum.com/showthread.php?threadid=46837

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default assigning a macro to a cell?

Just built this in Excel 2000.
It puts in buttons from the Forms Toolbar and places then
to the right of the cell in J.
It than assigns the macro "Macro3" to the button.

The button position is defined by c.Offset(0, 1)
The 1 is the next cell to the right, 2 is the 2nd, ....

See if this is what you need...

Sub MakeButtons()
Dim rw As Long, c, firstAddress, x, y
With ActiveSheet.Range("J2:J200")

Set c = .Find("need to pay", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
x = c.Offset(0, 1).Top
y = c.Offset(0, 1).Left
ActiveSheet.Buttons.Add(y, x, 48.75, 13.5).Select
Selection.Name = "Button" & c.Row
Selection.OnAction = "Macro3"
ActiveSheet.Shapes("Button" & c.Row).Select
Selection.Characters.Text = ""

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Cells(2, 10).Select
End Sub


--
steveB

Remove "AYN" from email to respond
"jhahes" wrote in
message ...

Can I do the following. I am a novice in VBA. I will try to explain to
the best of my ability.

In Sheet1

I want the code to start in J2 and search down all of the column until
J200. If it finds the words NEED TO PAY, then put a command button or
anything that can run an assigned macro in the corresponding column
(K). So if the loop or code finds the words NEED TO PAY in J10 it
would put a button or someting in K10 that would run a macro(have the
ability to run a macro, don't run now), only if it is clicked.

Any help would be wonderful,

please let me know, I probably didn't explain very well

Thanks
josh


--
jhahes
------------------------------------------------------------------------
jhahes's Profile:
http://www.excelforum.com/member.php...o&userid=23596
View this thread: http://www.excelforum.com/showthread...hreadid=468371



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default assigning a macro to a cell?

P.S.

Your description was clear to me. Especially for a "novice" - well done.

The only thing you might have included is whether or not each button gets
the same macro or not...

And it is recommended that you include which version of Excel you are
using...

--
steveB

Remove "AYN" from email to respond
"jhahes" wrote in
message ...

Can I do the following. I am a novice in VBA. I will try to explain to
the best of my ability.

In Sheet1

I want the code to start in J2 and search down all of the column until
J200. If it finds the words NEED TO PAY, then put a command button or
anything that can run an assigned macro in the corresponding column
(K). So if the loop or code finds the words NEED TO PAY in J10 it
would put a button or someting in K10 that would run a macro(have the
ability to run a macro, don't run now), only if it is clicked.

Any help would be wonderful,

please let me know, I probably didn't explain very well

Thanks
josh


--
jhahes
------------------------------------------------------------------------
jhahes's Profile:
http://www.excelforum.com/member.php...o&userid=23596
View this thread: http://www.excelforum.com/showthread...hreadid=468371



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
assigning value in macro tina Excel Programming 4 October 29th 09 03:33 PM
assigning macro carrera Excel Discussion (Misc queries) 16 March 21st 08 09:00 PM
Assigning Macro to a cell Peter[_54_] Excel Programming 2 July 29th 05 07:12 PM
assigning macro to cell Adam Excel Programming 6 April 22nd 05 05:19 PM
Macro assigning help PLEASE Jim Rech Excel Programming 0 February 10th 04 10:03 PM


All times are GMT +1. The time now is 03:11 PM.

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"