LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Formatting Cell Based on Text in Column Beside It - Round 2

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting based on text in another cell Dave Eade Excel Discussion (Misc queries) 1 January 23rd 09 03:59 PM
Conditional formatting based off cell with text? (i.e. "less than MikeV Excel Discussion (Misc queries) 3 February 13th 08 10:02 PM
Conditional formatting Based on cell A text with conditions in Cell B Raicomm Excel Discussion (Misc queries) 0 January 21st 08 04:46 PM
Conditional Formatting based on text within a cell w/ text AND num Shirley Excel Worksheet Functions 2 December 22nd 06 01:40 AM
Deleting Rows based on text in cell & formatting cell based on text in column beside it Steve Excel Programming 4 February 26th 04 03:31 PM


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"