|
-
Jul 30th, 2003, 02:18 PM
#1
Thread Starter
Hyperactive Member
how do I write a macro to replace certain cells in a colum depending on other cell va
Hello,
I am very new to spreadsheets...
I was wondering if anyone can help me with writing a macro
that would replace cell values in a column based a values in certain cells in that column.
//i would like to replace the values of cells that have the value 0 in them with the value of a variable.
<pseudocode>
Sub ChangeAll()
dim intValueOfCell
Range("A1").Select
intValueOfCell= ActiveCell.Value
Do While ActiveCell.Value <> "" 'cell is empty
If ActiveCell.Value = 0 Then
ActiveCell.Value = intValueOfCell
Else
intValueOfCell = ActiveCell.Value
End If
'select next cell in column (don't know what is the code for that
' maybe ****************
Selection.Offset(0,1).Select
'**********************
Loop
Range("A1").Select
End Sub
</pseudocode>
example of a column
***column 1***
12
0
0
0
17
0
0
89
0
0
0
0
102
0
0
160
etc...
************
I would do this manualy but there are over 8000 records (cells)
with values in them
Please help
bsw
Last edited by bsw2112; Jul 30th, 2003 at 02:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|