# Selecting a range of cells

#### joethoden

##### New Member
Hello, I was able to use information provided here to fix a problem I had in some code & now I am trying something along the same line as before but with a little twist. I am taking every 45th cell in a column & transfering that info to another sheet in consecutive order.
The code below works great for that & I have been able to modify it slightly to get the correct info from one place & transfer it into another but I am wondering if there is someway to alter it so as to select a range of cells on each 45th row such as C37 to H37 on the "Daily Readings" sheet & have that equal C9 to H9 on the "River Temps". Any suggestions?
Thanks,
Joe

Sub Unit2Generation()
y = 11
For x = 9 To 1350 Step 45
Sheets("River Temps").Cells(y, 3) = Sheets("Daily Readings").Cells(x, 6)
y = y + 1
Next x
End Sub

### Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How is C37 a 45th row?

OOP's!!!! The Code should read as follows:

Sub Unit2Generation()
y = 11
For x = 37 To 1387 Step 45
Sheets("River Temps").Cells(y, 3) = Sheets("Daily Readings").Cells(x, 6)
y = y + 1
Next x
End Sub

Did you want to take the value from every 45th row starting at row 37 from the Daily Readings sheet and put it on the River Temps sheet starting on row 9?

or

Do you want to take the values from River Temps starting at row 9 and put them on the Daily Readings Sheet every 45 rows starting at row 37?

Sorry for the confusion - I'm at work running back & forth between two different projects & trying to work on this at the same time.
I am wanting to take the values at C37 through H37 on the daily reading sheet and transfer them to the River Temp sheet starting at C11 through H11. The code works great for taking every 45th cell down the row & placing them in consecutive order on the 2nd sheet but now I am trying to take 6 cells in the same row & transfer them to the second sheet at the same time.

Joe

OK, give this a try:

Code:
``````Sub Unit2Generation_TEST()
Dim x As Integer, y As Integer
y = 11
Application.ScreenUpdating = False
For x = 37 To 1387 Step 45
Worksheets("Daily Readings").Range("C" & x & ":H" & x).Copy
Worksheets("River Temps").Range("C" & y & ":H" & y).PasteSpecial
Application.CutCopyMode = False
y = y + 1
Next x
Application.ScreenUpdating = True
End Sub``````

That code works fine! I did not get a chance to try it until this morning. I am still trying to understand how it works or rather what everything means in the code, specifically the lines beginning with "Application" The rest I can see what it is saying. Little at a time I learn more about it. Thanks again for your help.
Joe

Replies
1
Views
269
Replies
2
Views
246
Replies
1
Views
853
Replies
5
Views
434
Replies
3
Views
354

1,203,073
Messages
6,053,379
Members
444,660
Latest member
Mingalsbe

### 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