Sub AppendSelection
dim LoopCell as range
For Each LoopCell in Selection
if len(LoopCell.Value)=8 then
LoopCell.Value="+62 " & LoopCell.Value
end if
Next
End Sub
you don't need VBA
you could just use formulae
="+62 " & A1
etc
Yes but that would add it to every cell regardless of whether it had 8 nuimbers in or not, and the implication in the original question was that the +62 needed adding to every cell that has 8 numbers and therefore not if there are not 8 numbers. So the VBA solution would allow for this, whereas your solution doesn't.
P | Pld | Pts | |
1 | Liverpool | 23 | 56 |
2 | Arsenal | 24 | 50 |
3 | Nottm F | 24 | 47 |
4 | Chelsea | 24 | 43 |
5 | Manchester C | 24 | 41 |
6 | Newcastle | 24 | 41 |
7 | Bournemouth | 24 | 40 |
8 | Aston Villa | 24 | 37 |
9 | Fulham | 24 | 36 |
10 | Brighton | 24 | 34 |
11 | Brentford | 24 | 31 |
12 | Palace | 24 | 30 |
13 | Manchester U | 24 | 29 |
14 | Tottenham | 24 | 27 |
15 | West Ham | 24 | 27 |
16 | Everton | 23 | 26 |
17 | Wolves | 24 | 19 |
18 | Leicester | 24 | 17 |
19 | Ipswich | 24 | 16 |
20 | Southampton | 24 | 9 |