View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
PBJ PBJ is offline
external usenet poster
 
Posts: 19
Default In VBA, How to Refer to Cell In Specific Column But Selected R

BJ: Thanks for your help! See my reply to JLatham, below.

"bj" wrote:

try
cell(Activecell.row,34) = "Completed"

"PBJ" wrote:

The following macro toggles between shading the selected row(s) gray or, if
they're shaded already, unshading them. (It opens a form to resolve the issue
if rows of more than one shade are selected.)

Sub ShadeRow()
Select Case Selection.Interior.ColorIndex
Case Is < 16
Selection.EntireRow.Interior.ColorIndex = 16
Case Is = 16
Selection.EntireRow.Interior.ColorIndex = xlNone
Case Else
ShadingOptions.Show
End Select
End Sub

It works pretty well. Probably this is a stupid question, but I'd really
like the macro to also insert the text "Completed" into the cell in column AH
(that is, 34) for whatever row(s) are being shaded. I've tried variations on
the Cells property, but I always end up inputing "Completed" into a cell that
is relative to the active cell, which isn't what I want. (Further, since it's
possible that columns may be added or deleted by users, I suppose that I
really should be referring to a vertical named range instead of the actual
column number.)

I'd appreciate any advice on my stupid little problem!