Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Question Macro to add value of (1) to a selected cell or cells?

I'm comfortable with excel and formulas but never used any of the developer features.

Can anyone tell me how I could:
click a button I have created on the sheet that will change the value of highlighted cells to the value (1) and fill the cells with a color?

In my head this is how it would work:
1) highlight a group of cells
2) Click the button
All highlighted cells would now contain the value 1 and be filled yellow.

I can create the button and assign a macro to it. I just have no idea how to write the macro, or if its even possible.

I'm open to other ideas if I am going about this all wrong.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 621
Default Add value of (1) to a selected cell or cells

Sub One_And_Color()
Dim rng As Range
Set rng = Selection
With rng
.Value = 1
.Interior.Color = vbYellow
End With
End Sub


Gord


On Mon, 16 Apr 2012 21:44:17 +0000, Coaxis
wrote:


I'm comfortable with excel and formulas but never used any of the
developer features.

Can anyone tell me how I could:
click a button I have created on the sheet that will change the value of
highlighted cells to the value (1) and fill the cells with a color?

In my head this is how it would work:
1) highlight a group of cells
2) Click the button
All highlighted cells would now contain the value 1 and be filled
yellow.

I can create the button and assign a macro to it. I just have no idea
how to write the macro, or if its even possible.

I'm open to other ideas if I am going about this all wrong.

  #3   Report Post  
Junior Member
 
Posts: 3
Thumbs up

Worked perfectly! just as I described.

Thanks for your help Gord!
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 621
Default Macro to add value of (1) to a selected cell or cells?

Good to hear.

Thanks for the feedback.

On Tue, 17 Apr 2012 18:28:14 +0000, Coaxis
wrote:


Worked perfectly! just as I described.

Thanks for your help Gord!

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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
using pre-selected cells in my own chart macro gauss1976[_2_] Excel Programming 0 July 20th 06 02:15 PM
Macro to select cells and then new selection from selected cells Rewop Eilsel Excel Programming 0 June 6th 06 04:25 PM
Copy Selected cells down a row with macro DB33 Excel Discussion (Misc queries) 1 February 15th 06 06:33 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"