View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
J.B. Bobbitt J.B. Bobbitt is offline
external usenet poster
 
Posts: 10
Default Help w/ VBA code

Oh, I will............. (and have).

-jbb


"JulieD" wrote in message
...
you're welcome ... do come back if you get stuck again.

"J.B. Bobbitt" wrote in message
nk.net...
Thanks and a hat tip, Julie. I'm off and running.

-jbb

"JulieD" wrote in message
...
Hi

personally i wouldn't worry about using VBA for this - i would type an
IF formula
=IF(A1<0,"string1","string2")
in cell B1 and then double click the autofill handle (bottom right hand
corner of the cell) - then i would select column B and copy - edit /
paste special values

however, if you do want code

Sub addstrings()
For Each c In Range("A1:A1500") 'set range to suit
If c.Value < 0 Then
c.Offset(0, 1).Value = "string1"
Else
c.Offset(0, 1).Value = "string2"
End If
Next
End Sub

--- note, this code assumes that column B is blank and can be used for
entry of the strings. It also assumes that each cell in column A has a
number either less than zero, zero or greater than zero.

Hope this helps
Cheers
JulieD


"J.B. Bobbitt" wrote in message
k.net...
Hi;

I'm new to VBA and need to get A LOT done quickly. I need help with
some simple code for the following:

I have a sheet with a column (~1500 rows) in which each cell contians a
numeric value. I want to create a new column in which cell contains a
text string based on the numeric value in the first column; i.e.:

If A1 < 0, then B1="string1"
If A1 =0, then B1="string2"

and so on for all cells in column.

Any help, suggestions?

Thanks in advance,
-jbb