#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Need a macro.


I need a macro that I can assign to a button that when pressed will copy
the text that is on that button into a cell. I'm stumped, ok well I
didn't even try because I know I would be up all night trying then I'd
ask anyway, so I'll just ask now.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=560553

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Need a macro.

It's difficult to know what 'the text' on the button is but as that is
unlikely to change this is how you would paste a constant text in a cell(s)

Sub PutTextInCell()
Selection.Value="MyText"
End Sub

Places MyText in the selected cell(s)
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"famdamly" wrote in
message ...

I need a macro that I can assign to a button that when pressed will copy
the text that is on that button into a cell. I'm stumped, ok well I
didn't even try because I know I would be up all night trying then I'd
ask anyway, so I'll just ask now.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile:
http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=560553



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Need a macro.


Thanks for the assistance. The text that I need entered into the cell is
depending on which button I push. The text on the buttons will change
depending on the users own customization. It's sort of my version of a
drop down menu. Someone selects a cell, which is like a field in a
form, they are zinged over to a screenfull of buttons, when they press
one they are zinged back over to the form. Rather than a little drop
down menu, I like to have larger selections to choose from thus
allowing me the possibility of utilizing visual aids. That's just the
way I like to navigate I guess.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=560553

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need a macro.

Is your form a worksheet designed to look like a form--or a real userform
(designed in the VBE)?

I'm assuming that it's a worksheet.

If you use a button from the forms toolbar, you can assign the same macro to
each button.

I'm not sure how you get from the selected cell to the worksheet with the
button, but this may help:


I put this in a General module:

Option Explicit
Public ActCell As Range
Sub testme()

Dim myBTN As Button

Set myBTN = ActiveSheet.Buttons(Application.Caller)

If ActCell Is Nothing Then
Beep
Else
ActCell.Value = myBTN.Caption
'go back
Application.Goto ActCell
Set ActCell = Nothing
End If

End Sub


I put this behind the worksheet that gets the captions:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub

Set ActCell = Target
Worksheets("sheetwithbuttons").Activate

End Sub


famdamly wrote:

Thanks for the assistance. The text that I need entered into the cell is
depending on which button I push. The text on the buttons will change
depending on the users own customization. It's sort of my version of a
drop down menu. Someone selects a cell, which is like a field in a
form, they are zinged over to a screenfull of buttons, when they press
one they are zinged back over to the form. Rather than a little drop
down menu, I like to have larger selections to choose from thus
allowing me the possibility of utilizing visual aids. That's just the
way I like to navigate I guess.

--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=560553


--

Dave Peterson
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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 01:30 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"