Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I got help a week or so ago on some VBA for a routine where I needed to change the number in a cell to a negative number based on the content of the cell to its right. However, after I copied it into VBA it will not work. I've changed the range ID on both but the only effect I've had is for it to change some cells to negative and it appears to be random at best. Here's an example of the dat
G 169.00 C 241.30 0.14 C 2276.0 For example I have a column of numbers and in the column directly to the right are cells with the letters "CR" for credit. What I want to do is to change the numbers to a negative if CR is in the cell to its right. Below is the code I received. Sorry for my ignorance on VBA. I'm okay with formulas, but just now learning how to better use macros, much less write VBA. Maybe I just don't understand what my ranges are, all I know is that I can't get it to work Thanks...stev Sub ChangingCredit( Dim credit As Strin Range("C7").Select 'starting poin Do Until x = 10 'Change number for extra number of blanks between dat rng = ActiveCel credit = ActiveCell.Offset(0, 1).Range("A1").Value 'assuming Cr right of numbe If credit = "CR" The ActiveCell.Value = rng * - End I ActiveCell.Offset(1, 0).Selec x = x + Loo End Su |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional Formatting based on text in another cell | Excel Discussion (Misc queries) | |||
Conditional formatting based off cell with text? (i.e. "less than | Excel Discussion (Misc queries) | |||
Conditional formatting Based on cell A text with conditions in Cell B | Excel Discussion (Misc queries) | |||
Conditional Formatting based on text within a cell w/ text AND num | Excel Worksheet Functions | |||
Deleting Rows based on text in cell & formatting cell based on text in column beside it | Excel Programming |