Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i have this code :
sub test() Dim j As Integer Dim i As Integer Dim x As Integer Dim rng1 As Range Dim rng2 As Range Sheets("sheet2").Select Range("A1:Z500").Select Selection.ClearContents Set rng1 = Worksheets("sheet1").Range("A1") Set rng2 = Worksheets("sheet2").Range("A1") x = rng1.CurrentRegion.Rows.Count - 1 For j = 0 To x For i = 0 To x rng2.Offset(j, i) = rng1.Offset(j, 0) Next i Next j For j = 0 To x rng2.Offset(j, j) = rng1.Offset(j, 0) + 0.1 Next j End Sub Sub ProcessData() Dim i As Integer, Cols As Integer 'move Sheet1 ColA to safe place Sheets("Sheet1").Activate [AA:AA].Value = [A:A].Value '...determine # of loops Sheets("Sheet2").Activate Cols = ActiveSheet.UsedRange.Columns.Count 'Start looping For i = 1 To Cols '...select Col i from Sheet2, paste to Sheet1 ColA Columns(i).Copy Sheets("Sheet1").Columns(1).PasteSpecial '...Copy Sheet3 Row 1 to Row i in Sheet 4 Sheets("Sheet4").Rows(i).Value = Sheets("Sheet3").Rows(1).Value Next i 'Restore Sheet1 ColA Sheets("Sheet1").Activate [A:A].Value = [AA:AA].Value End Sub ----------------------------------- i m having an error on sheet 4.. its giving me the right answer but afer that .. its giving me lots of columns and rows of zeros and numerical data .. its abt 35 rows... why is this can some one help with code... is somthg misssing ? sam |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
stuck in an error loop | Excel Discussion (Misc queries) | |||
loop code error help!!!! | Excel Discussion (Misc queries) | |||
Error on second pass of loop. | Excel Discussion (Misc queries) | |||
error on second pass of loop. | Excel Discussion (Misc queries) | |||
loop error | Excel Programming |