Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Return the values in another sheet

I have 2 sheets in a workbook. I am trying to code a procedure which
will cause the value of Sheet 2 to return the value contained is Sheet
1. Each row increments by 4 (ie - B4, B8, B12, B16...) and starts at
row 4, except for B5.

Sheet 2 A1 = value in sheet1 B4
Sheet 2 B1 = value in sheet1 C4
Sheet 2 C1 = value in sheet1 B5

Sheet 2 A2 = value in sheet1 B8
Sheet 2 B2 = value in sheet1 C8
Sheet 2 C2 = value in sheet1 B9

Sheet 2 A3 = value in sheet1 B12
Sheet 2 B3 = value in sheet1 C12
Sheet 2 C3 = value in sheet1 B13

And so on, until Sheet 1 ends, around row 2,500.

Thanks in advance for any assistance...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Return the values in another sheet

Hi Steve

This should do the trick. I assume you are in Sheet2 when this is
run.

Take care

Marcus

Sub Down4Rows()

Dim i As Long, j As Long, lw As Long
'Run in sheet2
Application.ScreenUpdating = False
'Last row of sheet 1
lw = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
j = 4 ' the 4th row in sheet1
For i = 1 To lw
Range("A" & i).Value = Sheets("Sheet1").Range("B" & j).Value
Range("B" & i).Value = Sheets("Sheet1").Range("C" & j).Value
Range("C" & i).Value = Sheets("Sheet1").Range("D" & j).Value
'etc etc
j = j + 4
Next i
Application.ScreenUpdating = True

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Return the values in another sheet

Thanks Marcus.

One small problem though. C1 needs to first equal the value in B5, not
D4, and then every 4th row after that (B5, B9, B13, B17, etc...)
It's a little different than the other 2.

On Feb 11, 9:03*pm, marcus wrote:
Hi Steve

This should do the trick. *I assume you are in Sheet2 when this is
run.

Take care

Marcus

Sub Down4Rows()

Dim i As Long, j As Long, lw As Long
'Run in sheet2
Application.ScreenUpdating = False
'Last row of sheet 1
lw = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
j = 4 ' the 4th row in sheet1
*For i = 1 To lw
* * Range("A" & i).Value = Sheets("Sheet1").Range("B" & j).Value
* * Range("B" & i).Value = Sheets("Sheet1").Range("C" & j).Value
* * Range("C" & i).Value = Sheets("Sheet1").Range("D" & j).Value
* * 'etc etc
* * j = j + 4
*Next i
Application.ScreenUpdating = True

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Return the values in another sheet

Hi Steve

My mistake. I made an assumption. Replace the third line in the loop
with this;

Range("C" & i).Value = Sheets("Sheet1").Range("B" & j + 1).Value

That should get the job done.

Take care

Marcus
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Used to return a worke sheet to origanan values wyatt131 Excel Discussion (Misc queries) 2 April 15th 10 10:03 PM
Look up in another sheet for values to return in 1st worksheet ralph Excel Discussion (Misc queries) 2 April 12th 10 02:32 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Excel Discussion (Misc queries) 1 October 5th 05 12:18 PM
VBA Syntax for VLOOKUP to return array of return values Alan Beban[_3_] Excel Programming 7 August 5th 03 11:41 AM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"