LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Put data in range of selected cells

I use a spreadsheet for duty rostas at work and have macros to enter codes
into a range of selected cells for various things like annual leave (H)
sickness (Y, S or F depending on certificate), maternity leave (M). I
currently merge the selected cells.

Here is an example of my macros.

Sub CodeM()
Application.Run "White"
Application.Run "CellsMerge"
ActiveCell.FormulaR1C1 = "M"
End Sub

Sub White()
ActiveCell.Font.Name = "Arial"
Selection.Font.FontStyle = "Bold"
Selection.Font.Size = 9
ColourCellWhite (0)
NoArrows (0)
End Sub

Sub CellsMerge()
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
End Sub

However, I don't really want the cells merged and would prefer the macro
'CodeM' (and other similar macros I have) to work through each highlighted
cell when the user clicks the button to run it and put the code in each one.

How do I get the macro to move through the selected cells, or put the same
code in all of them.

Many thanks.
 
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
Average Selected Cells From a Range pdberger Excel Worksheet Functions 3 July 19th 07 05:21 PM
data validation list selected from a range Native Excel Discussion (Misc queries) 11 January 20th 06 01:11 AM
How can i put a negative sign on a range of selected cells? chermaine Excel Discussion (Misc queries) 3 August 8th 05 02:49 AM
Automatically clear values from a range of selected cells John Davies Excel Discussion (Misc queries) 1 June 28th 05 04:42 PM
How do I merge in a selected range of cells out of Excel? powertots4 Excel Discussion (Misc queries) 1 December 28th 04 08:01 PM


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