How do I change the output destination in a For loop

Djbdrake

New Member
Joined
Oct 2, 2019
Messages
6
I'm currently trying to put a string of cells together in a and complete it across several columns but I can't figure out how to change the destination for the output each time

Sub test()
Dim x
x = 7
For x = 7 To 595
Dim rng As Range
Dim i As String
For Each rng In Selection
i = i & rng
Next rng
Range("B1").Value = Trim(i)
Next x
End Sub
 

KOKOSEK

Board Regular
Joined
Apr 8, 2019
Messages
158
Office Version
365, 2013
Platform
Windows
Code:
Range("B"& (X-6)).Value = Trim(i)
p.s. you create loop for x from 7 so remove line above: x=7
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,113
Office Version
365
Platform
Windows
Try
Cells(1,x-6).value=Trim(i)
 

Forum statistics

Threads
1,077,635
Messages
5,335,379
Members
399,014
Latest member
hamzalaarif

Some videos you may like

This Week's Hot Topics

Top