ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   transfer data between worksheets (https://www.excelbanter.com/excel-programming/330220-re-transfer-data-between-worksheets.html)

Alok

transfer data between worksheets
 
This will do it

Private Sub Command1_Click()

Dim Daily As Worksheet
Dim Data As Worksheet
Dim i%

Set Daily = Worksheets("Daily")
Set Data = Worksheets("Data")

For i = 1 To 26

Daily.Range("A12").Offset((i - 1) * 20, 0).Value =
Data.Range("A5").Offset(i - 1, 0).Value
'Daily.Range("A32").Value = Data.Range("A6").Value
'all the way down to'
'Daily.Range("A562").Value = Data.Range("A30").Value

Next i

End Sub

Alok Joshi


"Qaspec" wrote:

right now i'm using the following code to transfer data. instead of
reapeating the line 26 times is there a way to create this code in a smaller
statement if the data row always increases by 20 and the daily row by 1.

Private Sub Command1_Click()

Dim Daily As Worksheet
Dim Data As Worksheet


Set Daily = Worksheets("Daily")
Set Data = Worksheets("Data")

Daily.Range("A12").Value = Data.Range("A5").Value
Daily.Range("A32").Value = Data.Range("A6").Value
'all the way down to'
Daily. Range("A562").Value=Data.Range("A30").Value



End Sub





All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com