View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Excel Macro - Calc to last row problem

Hi Mick,

Here it is

Sub TestLoopUp()
Dim i As Long

For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i, "A").Offset(0, 2).Value = "SC" Then
Cells(i, "D").Value = Cells(i, "B").Value * -1
End If
Next i

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mickw " wrote in message
...
This is my first post. I am new to excel macros and need some help
please.

I need to create a macro that I can run every month on that month's
invoices.

I can do all the manipluations I want, apart from one type. I want to
create a column with a formula from row 2 to the last row of data.
Because the number of rows varies each month I cannot see how to
achieve this.

Example

Column A = invoice number
Column B = invoice value
Column C = invoice sign (SI or SC)

I want to multiply the invoice value by -1 if the invoice sign is SC
for every row that contains an invoice number.

Any help would be appreciated.

Cheers,

Mick


---
Message posted from http://www.ExcelForum.com/