Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odds need period, evens need semicolon
A long list of names looks like
Tiger Cat Dog Goose I want to add a period after Tiger, Dog, and add a semicolon after Cat and Goose. What is the feasible approach? Loop will not work, right? How about array? Can you give me a few lines of codes? Thanks a lot! H.Z. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odds need period, evens need semicolon
Where is this long list of names at? What is the rule that determines which
gets a period and which gets a semi-colon? Rick "Curious" wrote in message ... A long list of names looks like Tiger Cat Dog Goose I want to add a period after Tiger, Dog, and add a semicolon after Cat and Goose. What is the feasible approach? Loop will not work, right? How about array? Can you give me a few lines of codes? Thanks a lot! H.Z. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Odds need period, evens need semicolon
Maybe...
=a1&if(mod(row(),2)=1,".",";") In code: Option Explicit Sub testme() Dim myCell As Range Dim myRng As Range Dim wks As Worksheet Set wks = Worksheets("sheet1") With wks Set myRng = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp)) End With For Each myCell In myRng.Cells If myCell.Row Mod 2 = 0 Then myCell.Value = myCell.Value & ";" Else myCell.Value = myCell.Value & "." End If Next myCell End Sub Curious wrote: A long list of names looks like Tiger Cat Dog Goose I want to add a period after Tiger, Dog, and add a semicolon after Cat and Goose. What is the feasible approach? Loop will not work, right? How about array? Can you give me a few lines of codes? Thanks a lot! H.Z. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Handling Excel Evens in addins | Excel Programming | |||
Period to Period percentage change? | Excel Discussion (Misc queries) | |||
Sorting Odds & Evens | Excel Programming | |||
Sorting Odds & Evens | Excel Programming | |||
Sorting Odds & Evens | Excel Programming |