Thread: Macro please!
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Macro please!

yes I guessed that see my next post
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"LeisaA" wrote:



"Mike H" wrote:

Hi,

Taking you literally and noting you have a max of 2 all capitalised words
then this should do it

Sub Marine()
Dim TempStr As String
Set sHt = Sheets("Sheet1") ' Change to suit
lastrow = sHt.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = sHt.Range("A1:A" & lastrow)
For Each c In MyRange
v = Split(c.Value, " ")
If v(0) = UCase(v(0)) Then TempStr = TempStr + v(0) & " "
If v(1) = UCase(v(1)) Then TempStr = TempStr + v(1)
c.Offset(, 1).Value = Trim(WorksheetFunction.Substitute(c.Value, TempStr, ""))
c.Value = Trim(TempStr)
TempStr = ""
Next
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"LeisaA" wrote:

I had some really great help yesterday, thanks to all that contributed!
However, I did not have success with the suggestions for this issue, I don't
know how to preform a nested function so macros work better for me can anyone
construct one for this? Thanks!

I'm trying to separate data as follows:

From this:
AAIM Aircraft Autonomous Integrity Monitor
ABAS Aircraft Based Augmenting System.

To this:
AAIM Aircraft Autonomous Integrity Monitor
ABAS Aircraft Based Augmenting System.

All caps to column 1 except the first letter of the sentence.

It won't work on space because I also have as follows:

ACCELERATION EAST Aircraft acceleration in true east direction
ACCELERATION EAST Aircraft acceleration in true east direction

To replace? I have 4958 lines....
Hi Mike, I have more than two words some have 5 and some are more.???