View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Worksheet change Macro Question

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1,B1" '<== change to suit
Dim cell As Range

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
For Each cell In Me.Range(Target.Offset(1, 0), _
Target.End(xlDown))

If IsNumeric(cell.Value) Then

cell.Value = cell.Value * (1 + .Value)
End If
Next cell
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Vick" wrote in message
...
That worked great, just had one more question. I have another column in
that
same spreadsheet I'd like to do the same thing too. So I have two lists,
one
in A and one in B with that % at the top. I'd like to change B1 and have
it
change Column B, and the same with A1 and A. Is that possible?

Thanks

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<== change to suit
Dim cell As Range

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
For Each cell In Me.Range(Target.Offset(1, 0),
Target.End(xlDown))

If IsNumeric(cell.Value) Then

cell.Value = cell.Value * (1 + .Value)
End If
Next cell
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Vick" wrote in message
...
I believe I need a worksheet change macro for this, I can't think of any
other way of doing it. I have one column that looks like this: The
rates
are
all static numbers no formulas. What I want to be able to do is that
whenever
someone changes the 0% cell or A1, that the macro will increase the
rates
by
that percentage. For example if I were to cahnge the % to 10% the rate
110
would change to 121. Thanks for any help you can give.

0%
Bill Rate
110
140
160
200
150
160
200
160
180
140
150
100
140
350
100

Vick