Thread: VB problem
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default VB problem

Put this SelectionChange event code in the code page for the worksheet where
you want this to work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
If Intersect(Target, Columns("D")) Is Nothing Then Exit Sub
For Each c In Target
If Len(c.Value) = 0 And IsNumeric(c.Offset(0, 9)) Then
c.Value = c.Offset(0, 9).Value
End If
Next c
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

"FiluDlidu" wrote:

I'm sure there's a way to do it, but I'm just starting to play with VB and I
don't know too much yet about it (this discussion group being filled with
kind people who seem to enjoy puzzles, I take a chance :-)

If I select a cell or range within column D, for every EMPTY cell of the
selected range whose equivalent in row M is a NUMBER, I want the number in
question to be copied over to the empty cell.

I'd like to kindly thank any who will spend even fruitless time on this
problem and to apologize to whoever might have conceived frustration at me
while doing so.

Feelu