Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have having trouble with the following lines....
Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dean,
With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats End With hth, Doug Glancy "Dean Goodmen" wrote in message ... I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That fixed my cell formatting issues, but it is still copying the values is the cells as well. (This is suppose to be adding a blank input line to a spreadsheet) On Sat, 13 Nov 2004 22:06:08 -0800, "Doug Glancy" wrote: Dean, With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats End With hth, Doug Glancy "Dean Goodmen" wrote in message .. . I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd just copy it like you did (assuming that you're using a newer version of
excel that supports xlPasteFormulasAndNumberFormats) and then wipe out the constants that were pasted. With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlPasteFormulasAndNumberFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With If you share with users who still run older versions of excel, you'll want to combine Doug's code: With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With Dean Goodmen wrote: I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Dave.
Doug "Dave Peterson" wrote in message ... I'd just copy it like you did (assuming that you're using a newer version of excel that supports xlPasteFormulasAndNumberFormats) and then wipe out the constants that were pasted. With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlPasteFormulasAndNumberFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With If you share with users who still run older versions of excel, you'll want to combine Doug's code: With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With Dean Goodmen wrote: I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Getting closer....Tehn the clear command is used it not only clears the values in the cell, but also clears the formatting :-( On Sun, 14 Nov 2004 09:05:37 -0800, "Doug Glancy" wrote: Thanks, Dave. Doug "Dave Peterson" wrote in message ... I'd just copy it like you did (assuming that you're using a newer version of excel that supports xlPasteFormulasAndNumberFormats) and then wipe out the constants that were pasted. With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlPasteFormulasAndNumberFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With If you share with users who still run older versions of excel, you'll want to combine Doug's code: With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With Dean Goodmen wrote: I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dean,
Change the Clear to ClearContents and that should do it. hth, Doug Glancy "Dean Goodmen" wrote in message ... Getting closer....Tehn the clear command is used it not only clears the values in the cell, but also clears the formatting :-( On Sun, 14 Nov 2004 09:05:37 -0800, "Doug Glancy" wrote: Thanks, Dave. Doug "Dave Peterson" wrote in message ... I'd just copy it like you did (assuming that you're using a newer version of excel that supports xlPasteFormulasAndNumberFormats) and then wipe out the constants that were pasted. With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlPasteFormulasAndNumberFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With If you share with users who still run older versions of excel, you'll want to combine Doug's code: With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With Dean Goodmen wrote: I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the correction.
Honest, I meant .clearcontents, really! Doug Glancy wrote: Dean, Change the Clear to ClearContents and that should do it. hth, Doug Glancy "Dean Goodmen" wrote in message ... Getting closer....Tehn the clear command is used it not only clears the values in the cell, but also clears the formatting :-( On Sun, 14 Nov 2004 09:05:37 -0800, "Doug Glancy" wrote: Thanks, Dave. Doug "Dave Peterson" wrote in message ... I'd just copy it like you did (assuming that you're using a newer version of excel that supports xlPasteFormulasAndNumberFormats) and then wipe out the constants that were pasted. With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlPasteFormulasAndNumberFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With If you share with users who still run older versions of excel, you'll want to combine Doug's code: With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpecial Paste:=xlFormulas .Rows(cRow + 1).PasteSpecial Paste:=xlFormats On Error Resume Next .Rows(cRow + 1).Cells.SpecialCells(xlCellTypeConstants).Clear On Error GoTo 0 End With Dean Goodmen wrote: I have having trouble with the following lines.... Here is what I want it to do : Copy the Row contained in value cRow, and insert a copy of it just below that row. (Only the Formaulas AND Borders, not the vlaues of the cells.) With Worksheets(1) .Rows(cRow + 1).Insert xlShiftDown .Rows(cRow).Copy .Rows(cRow + 1).PasteSpeciaxlPasteFormulasAndNumberFormats End With -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert rows and copy forumla above it | Excel Discussion (Misc queries) | |||
Copy/Insert rows | Excel Discussion (Misc queries) | |||
Copy/Insert rows with formulas | Excel Worksheet Functions | |||
Copy Rows and insert these rows before a page break | Excel Programming | |||
Copy insert rows | Excel Programming |