LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula problem in code


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
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
Code problem Ruben Excel Discussion (Misc queries) 4 August 26th 08 08:22 AM
If/then code problem peter.thompson[_12_] Excel Programming 2 December 27th 05 03:19 AM
Problem with Code --- Please help Les Stout[_2_] Excel Programming 11 October 17th 05 09:47 PM
Can anyone see the problem with this code? Cody Excel Programming 5 July 21st 05 11:23 PM
Syntax Problem with formula code Todd Huttenstine Excel Programming 7 May 10th 04 05:35 PM


All times are GMT +1. The time now is 11:11 AM.

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

About Us

"It's about Microsoft Excel"