LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default For...Next Loop

Between using the macro recorder and recycling some code that I found on this
DG a while back, I tried to create a simple loop to select a range of cells
on each sheet in my workbook, and copy/paste the values into 'Summary'. I
dont want to copy the Range("B39:T39") from the €˜Summary, but I do want it
from all other sheets€¦.and then copy/paste it to the €˜Summary. Should be a
simple fix€¦I hope€¦


Code listed below; would someone please explain what I am doing wrong:

Sub ListData()

Dim A As Integer
Dim rng2 As Range
Set rng2 = Range("B3")

For Each rng2 In ActiveWorkbook.Sheets
If (Sheet.Name) < "Summary" Then

Range("B39:T39").Select
Selection.Copy

Sheets("Summary").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

rng2.Offset(I, 0).Value = Sheet.Name
A = A + 1
End If
Next rng2

End Sub


PS, sorry if this double-posts...I think I just got kicked out of my
original posting window...

--
RyGuy
 
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
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM


All times are GMT +1. The time now is 11:21 AM.

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

About Us

"It's about Microsoft Excel"