View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
aircraft_model VBA aircraft_model VBA is offline
external usenet poster
 
Posts: 5
Default Aircraft Scheduling Problem VBA code needs adjustment.

I have a fairly simple challenge and while writing a macro and I got
stuck....

My challenge:

I want to detect cells with a certain value in a column, and if the
result is true, I want letter "e" to be added as a suffix to the
existing text in another column. For instance, if values in (Aircraft
Code), Column B = CRJ, or EMB, or EMR, then the letter "e", signifying
express should be added as a suffix to the text in column A in the
correspoding row. The goal is to add E - for Express Flights to Airlines
operating CRJ, or, EMB, or EMR aircraft.

For e.g.
Before macro

Column A Column B
CO CRJ

After macro

Column A Column B
COE CRJ

As you can see, I tack on an "E' following the CO, to depict Express
flights.

My solution (doen't work??):

I took a stab at writing some code and Im stuck with just some
structure, which may not make much sense, but if you could help I'd
appreciate it...

Sub ExpressLink()
For Each amount In Range("B:B") 'Substitute your range here
If amount.Value = CRJ Then
amount.Value = 0 '.........instead, how can i say, value in
another cell in Column A on the same row - or something
End If
Next amount
For Each amount In Range("B:B") 'Substitute your range here
If amount.Value = EMB Then
amount.Value = 0 '.........instead, how can i say, value in
another cell in column A on the same row - or something
End If
Next amount
End Sub

Appreciate any help on this. I have a spreadsheet with about 35K rows,
so your VBA contribution will be a Thanksgivin' present!

Thank you in advance

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!