Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy first row of a sheet to a new sheet in vba
Try not selecting:
With Sheets("Inschrijvingen") .Rows("1:1").Copy set rng = .Range("A1") Do While Not IsEmpty(rng) If rng.Offset(0, 13).Value = "Nee" Or _ rng.Offset(0,13).Value = "N" Then If Not SheetExists("Melden landelijke dd " & Date) Then Worksheets.Add.Move After:=Worksheets(Worksheets.Count) Set CurSheet = ActiveSheet CurSheet.Name = "Melden landelijke dd " & Date CurSheet.Range("A1").PasteSpecial xlPasteAll Sheets("Inschrijvingen").Activate End If End if 'copy what i need and go on Loop End With Not sure the above accomplishes what you want because your original code didn't seem to do much - but I believe the above will do what your original code was doing without selecting. -- Regards, Tom Ogilvy hans wrote in message ... I use the following macro: Sheets("Inschrijvingen").Select Rows("1:1").Select Selection.Copy Range("a1").Select ActiveCell.Offset(1, 0).Select Do While Not IsEmpty(ActiveCell) If ActiveCell.Offset(0, 13).Value = "Nee" Or ActiveCell.Offset(0,13).Value = "N" Then If Not SheetExists("Melden landelijke dd " & Date) Then Worksheets.Add.Move After:=Worksheets(Worksheets.Count) Set CurSheet = ActiveSheet CurSheet.Name = "Melden landelijke dd " & Date Range("A1").Select ************* ActiveSheet.Paste ************* Sheets("Inschrijvingen").Select End If 'copy what i need and go on ActiveCell.Offset(1, 0).Select Loop I get an error on the line with the ********** What am i doing wrong? Greetings Hans |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy rows from one Data sheet to another sheet based on cell conte | Excel Discussion (Misc queries) | |||
Auto Copy/autofill Text from sheet to sheet if meets criteria | Excel Discussion (Misc queries) | |||
Search for rows in one sheet and copy into another sheet based on customer id | Excel Worksheet Functions | |||
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 | Excel Worksheet Functions | |||
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. | Excel Discussion (Misc queries) |