View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default genius wanted VBS

Did it not run, or did it produce an error? To limit the code to column 6

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each cell in Target
if cell.column = 6 then
cell.Font.Size = 10
cell.Interior.ColorIndex = 0
cell.Font.Size = 14
cell.Interior.ColorIndex = 24
end if
next cell
End Sub




"lost in Chicago" wrote:

didnt work Joel would like to limit the action to column 6 when selected the
color and font change but change back when unselected only in column 6 and it
must let me copy and paste the rows

"Joel" wrote:

Simple. Target can be multiple cells when you copy a range of data like rows
or columns.. You need to have a for loop to look at every cell.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
for each cell in Target
cell.Font.Size = 10
cell.Interior.ColorIndex = 0
cell.Font.Size = 14
cell.Interior.ColorIndex = 24
next cell
End Sub


"lost in Chicago" wrote:

Got this to work but it wont let me copy and paste rows or coumns need to
exclude then from the VBS any ideas?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Font.Size = 10
Cells.Interior.ColorIndex = 0
Target.Font.Size = 14
Target.Interior.ColorIndex = 24
End Sub