Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VB problem
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
VB problem
That worked just like a charm.
Thanks for taking the time to answer and also for the link you provided in your message. That was very kind. Feelu "Tom Hutchins" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) |