# Nested Loop?

#### JackDanIce

##### Well-known Member
Hi,

Have the following code which works fine but I think it can be reduced by placing into a nested loop, but I'm not sure how to make sure the string variables are built up properly:
Code:
``````e = Range("EmailList").Row + 1
Do
Email_List = Email_List & Cells(e, c) & "; "
e = e + 1
Loop Until IsEmpty(Cells(e, c))

e = Range("EmailList").Row + 1
Do
Email_CC = Email_CC & Cells(e, c + 1) & "; "
e = e + 1
Loop Until IsEmpty(Cells(e, c + 1))

e = Range("EmailList").Row + 1
Do
Email_BCC = Email_BCC & Cells(e, c + 2) & "; "
e = e + 1
Loop Until IsEmpty(Cells(e, c + 2))``````
Can this be nested?

Jack

### Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Thought of this but I question if it's an improvement (probably not then):
Code:
``````Dim i As Long
e = range("EmailList").Row + 1
For i = 0 To 2
Do
TempS = TempS & Cells(e, c + i) & "; "
e = e + 1
Loop Until IsEmpty(Cells(e, c + i))

Select Case i
Case 0
Email_List = TempS
Case 1
Email_CC = TempS
Case 2
Email_BCC = TempS
End Select

e = range("EmailList").Row + 1
TempS = Empty

Next i``````

Last edited:

Replies
5
Views
369
Replies
2
Views
323
Replies
0
Views
276
Replies
4
Views
2K
Replies
10
Views
344

1,196,429
Messages
6,015,207
Members
441,882
Latest member
rcgyuk

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back