Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
dim problem when using cell() reference
I am trying to write codes that will add or subtract a number from a previous
number, depending on whether or not certain cells are blank. It's an excel version of a checkbook: if there's nothing listed in credit, subtract the debit and if the debit is blank, add the credit to the previous balance. I'm having trouble with the dim part for the total. I don't know what to set it as. I've attached the code I have so far. Thanks! Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim row As Integer row = 3 Dim total As Long Do Set total = Sheets("Sheet1").Cells(row, F) If Cells(row, D) = 0 Then If Cells(row, E) = 0 Then total.Value = 0 Else total.Value = Cells(row - 1, F) + Cells(row, E) End If Else: total.Value = Cells(row - 1, F) - Cells(row, D) End If If row < 100 Then row = row + 1 Else: End End If Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell reference formula problem | Excel Discussion (Misc queries) | |||
Problem w/ cell reference | Excel Discussion (Misc queries) | |||
Cell reference problem | Excel Worksheet Functions | |||
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. | Excel Worksheet Functions | |||
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable | Excel Worksheet Functions |