View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
erikhs[_12_] erikhs[_12_] is offline
external usenet poster
 
Posts: 1
Default Shuffle through sheets in a loop?


Hi, i cant get it to work, it seems it copies the data on the first
sheet over and over again, here is my code:

Sub Macro1()
'The data i want to copy
Dim MyRange As Range

'
Dim wkb As Workbook
Dim wks As Worksheet
Dim i As Integer

'Dynamic range for the separate sheets
Range("a6", Range("v6").End(xlDown)).Name = "MyRange"
On Error Resume Next

'Add title and "paste" sheet"
Rows("5").Copy
Worksheets.Add.Name = "Edited"

'Your code
Set wkb = Application.ActiveWorkbook
For i = 1 To wkb.Worksheets.Count
Set wks = wkb.Worksheets(i)
If wks.Name < "Redigeret" Then
'My copy/pasté
Range("MyRange").Copy
Sheets("Edited").Select
'Paste at first blank cell in column A. This doesn't work either by
'the way. Any suggestions?
Set firstBlank = Range("A1").End(xlDown).Offset(1, 0)
Range("firstblank").Select
ActiveCell.PasteSpecial
Else

End If
Next i

End Sub


What could be wronh? Anyone else? Help would really be appreciated!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=562405