Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Im just learning this and have almost no clue what Im doing. I have the following code in my worksheet. It 'seems' to be working fine except the formulas I have between the Emoticons. Right now I have the proper functions I would like in there but, D2 should be Column D, E2 should be Column E, F2 should be Column F, and etc.. Each row is going to have the same formulas in them columns. Also it would help if it wouldnt display "#N/A" or "#NAME?" when data is not there. And 1 more thing, If I put a employee ID# that doesnt exist, it still puts info in. I put an example .xls here, It will probably give you a better idea: http://www.ashleylandscaping.com/sample.xls Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim wsPay As Worksheet, wsEmp As Worksheet Dim rngCheck As Range Dim c As Range, B As Range, D As Range, F As Range, G As Range Dim c As Range, H As Range, I As Range, J As Range Set wsEmp = Sheets("Employee(s)") Set wsPay = Sheets("Employee(s) Pay") Set rngCheck = wsEmp.Range("A:A") If Intersect(Target, [A:A]) Is Nothing Then Exit Sub Application.ScreenUpdating = False For Each c In Intersect(Target, [A:A]) Range("B" & c.Row).Formula = "=LOOKUP(A:A,'Employee(s)'!A:A,'Employee(s)'!B :B)" Range("D" & c.Row).Formula = "=LOOKUP(A:A,'Employee(s)'!A:A,'Employee(s)'!G :G)" :- Range("F" & c.Row).Formula = "=IF(E240,(E2-40)*(1.5*D2)+(D2*40),D2*E2)" Range("G" & c.Row).Formula = "=ROUND(F2*0.154,2)" Range("H" & c.Row).Formula = "=ROUND(F2*0.0765,2)" Range("I" & c.Row).Formula = "=ROUND(F2*0.0308,2)" Range("J" & c.Row).Formula = "=ROUND(F2-G2-H2-I2,2)" :- Next c Application.ScreenUpdating = True End Sub Thanks, Any help would be appreciated. -- cbrd ------------------------------------------------------------------------ cbrd's Profile: http://www.excelforum.com/member.php...o&userid=30009 View this thread: http://www.excelforum.com/showthread...hreadid=497487 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code problem | Excel Discussion (Misc queries) | |||
If/then code problem | Excel Programming | |||
Problem with Code --- Please help | Excel Programming | |||
Can anyone see the problem with this code? | Excel Programming | |||
Syntax Problem with formula code | Excel Programming |