Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default change existing values

I have a vlookup table with 3 columns (part number, below 25, above 25)
i sell part number 123456, i get $5 commission (up to 25)
after 25 commission goes to $10 (for all items sold even before 25)
so i have a list:
#24 123456 $5
#25 123456 $10

how can i get it to recalculate the first 24 to $10
(the problem is that i dont want to use equations i need values)
because next month the commission might change and i want these values to
stay the same

thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default change existing values

Assuming that your lookup table is on sheet2, and is called commission

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 2 Then
With Target
If .Offset(0, -1).Value < 25 Then
.Offset(0, 1).Value = WorksheetFunction.VLookup( _
.Value, Worksheets("Sheet2").Range("commission"), 2,
False)
Else
.Offset(0, 1).Value = WorksheetFunction.VLookup( _
.Value, Worksheets("Sheet2").Range("commission"), 3,
False)
End If
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

RP
(remove nothere from the email address if mailing direct)


"choice" wrote in message
...
I have a vlookup table with 3 columns (part number, below 25, above 25)
i sell part number 123456, i get $5 commission (up to 25)
after 25 commission goes to $10 (for all items sold even before 25)
so i have a list:
#24 123456 $5
#25 123456 $10

how can i get it to recalculate the first 24 to $10
(the problem is that i dont want to use equations i need values)
because next month the commission might change and i want these values to
stay the same

thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default change existing values

this will change old values to 10 if col a has 24 and col b matches part
nos.
right click sheet tabview codecopy paste thisSAVE

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Then Exit Sub
If Target.Offset(0, -1) 24 Then
For Each c In Range("b2:b" & Cells(Rows.Count, "b").End(xlUp).Row)
If c = Target Then c.Offset(0, 1) = 10
Next
End If
End Sub

--
Don Guillett
SalesAid Software

"choice" wrote in message
...
I have a vlookup table with 3 columns (part number, below 25, above 25)
i sell part number 123456, i get $5 commission (up to 25)
after 25 commission goes to $10 (for all items sold even before 25)
so i have a list:
#24 123456 $5
#25 123456 $10

how can i get it to recalculate the first 24 to $10
(the problem is that i dont want to use equations i need values)
because next month the commission might change and i want these values to
stay the same

thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default change existing values

the tricky part is that i only want it to change the values of this months
entries:
(Columns)
(A) Date (B) Part number (C) Commission

"Don Guillett" wrote:

this will change old values to 10 if col a has 24 and col b matches part
nos.
right click sheet tabview codecopy paste thisSAVE

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 2 Then Exit Sub
If Target.Offset(0, -1) 24 Then
For Each c In Range("b2:b" & Cells(Rows.Count, "b").End(xlUp).Row)
If c = Target Then c.Offset(0, 1) = 10
Next
End If
End Sub

--
Don Guillett
SalesAid Software

"choice" wrote in message
...
I have a vlookup table with 3 columns (part number, below 25, above 25)
i sell part number 123456, i get $5 commission (up to 25)
after 25 commission goes to $10 (for all items sold even before 25)
so i have a list:
#24 123456 $5
#25 123456 $10

how can i get it to recalculate the first 24 to $10
(the problem is that i dont want to use equations i need values)
because next month the commission might change and i want these values to
stay the same

thanks in advance




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to find change and paste existing values/rows in excel with help of form Claudia Excel Discussion (Misc queries) 1 August 10th 06 03:03 PM
How to change an existing query Gireeshm Excel Discussion (Misc queries) 0 July 18th 06 12:33 PM
How to add characters to all existing values in a given column Danny Excel Worksheet Functions 4 April 11th 06 09:59 PM
Search for existing values in woorksheet!? Daniel[_10_] Excel Programming 4 May 4th 04 12:02 PM
Change to existing macro Jerry[_14_] Excel Programming 5 November 4th 03 01:51 PM


All times are GMT +1. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"