View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Sheeloo[_3_] Sheeloo[_3_] is offline
external usenet poster
 
Posts: 1,805
Default Need a help of preparing excel macro

append @hotmail.com to to_sheeloo or click on my name for instructions to
get the mail

"Kamlu" wrote:

Hi Sheeloo,

Thanks for your help. I have checked this Macro & it is giving output but
not to 100%. Can you please give me email ID so I can send you example file.

Kam.

"Sheeloo" wrote:

Chris,

This will not work as there may be one, two or more than two rows for a Bill
No.

"Chris Bode via OfficeKB.com" wrote:

You can do this using a macro
Please follow following steps
1.Right Click toolbarclick control box
2.From control box select a command button and draw it to your sheet
3.Double click the command button to open code window and paste following
codes
Private Sub CommandButton1_Click()
Dim row As Integer, col As Integer
row = 2
col = 2

Dim amt1 As Double, amt2 As Double
amt1 = 0
amt2 = 0

While Sheet1.Cells(row, col).Value < ""

If Sheet1.Cells(row, col).Value = Sheet1.Cells(row - 1, col).Value
Then
amt1 = CDbl(Trim(Sheet1.Cells(row, col + 2).Value))
amt2 = CDbl(Trim(Sheet1.Cells(row - 1, col + 2).Value))

If Abs(amt1 + amt2) <= 10 Then

Sheet1.Cells(row, col + 3).Value = "C"
Sheet1.Cells(row - 1, col + 3).Value = "C"

End If

End If

row = row + 1
Wend
End Sub

Now you will get the result on clicking the command button

Hope this one works for you

Have a nice time€¦.

Chris
------
Convert your Excel spreadsheet into an online calculator.
http://www.spreadsheetconverter.com

--
Message posted via http://www.officekb.com