Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default How to insert rows as value?

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to insert rows as value?

Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Activate
LastRow = Cells(Rows.Count, "A").End(xlup).Row
Rows((LastRow + 1) & ":" & (LastRow + 1)).Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


"nk" wrote:

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk



  #3   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default How to insert rows as value?

Thank you, Joel.

However, the code seems to past only first row which has "Payment" in column
S in "JGB" sheet.
It does not past the rest 3 rows.
Is anything else need to be added?

Thank you for help again.

nk

"Joel" wrote:

Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Activate
LastRow = Cells(Rows.Count, "A").End(xlup).Row
Rows((LastRow + 1) & ":" & (LastRow + 1)).Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


"nk" wrote:

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to insert rows as value?

I'm not usre what you are asking. The LastRow is checking column "A" to
determine where the last row of data is located. You can change "A" to any
column.

You code is copying only the row that is active. Is you want more than one
row then do the following:

from:
ActiveCell.EntireRow.Select
selection.Copy
to:
Range(ActiveCell, ActiveCell.Offset(2, 0)).EntireRow.Copy

Note: Your original code could of been done in one row
ActiveCell.EntireRow.Copy

"nk" wrote:

Thank you, Joel.

However, the code seems to past only first row which has "Payment" in column
S in "JGB" sheet.
It does not past the rest 3 rows.
Is anything else need to be added?

Thank you for help again.

nk

"Joel" wrote:

Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Activate
LastRow = Cells(Rows.Count, "A").End(xlup).Row
Rows((LastRow + 1) & ":" & (LastRow + 1)).Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


"nk" wrote:

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk



  #5   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default How to insert rows as value?

Sorry... your codes were working. I found it was another problem. I raised
another question with title "How to select cells in specific Columns?". I
would appreciate it if you could take a look at it, too. Thank you.

"Joel" wrote:

I'm not usre what you are asking. The LastRow is checking column "A" to
determine where the last row of data is located. You can change "A" to any
column.

You code is copying only the row that is active. Is you want more than one
row then do the following:

from:
ActiveCell.EntireRow.Select
selection.Copy
to:
Range(ActiveCell, ActiveCell.Offset(2, 0)).EntireRow.Copy

Note: Your original code could of been done in one row
ActiveCell.EntireRow.Copy

"nk" wrote:

Thank you, Joel.

However, the code seems to past only first row which has "Payment" in column
S in "JGB" sheet.
It does not past the rest 3 rows.
Is anything else need to be added?

Thank you for help again.

nk

"Joel" wrote:

Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Activate
LastRow = Cells(Rows.Count, "A").End(xlup).Row
Rows((LastRow + 1) & ":" & (LastRow + 1)).Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


"nk" wrote:

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to insert rows as value?

I'm looking at your questions and your code. I try to aviod selecting and
activating cells. I prefer to use just the cell name.

you could change as follows

from:
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then


to:
Do until Range("A4").value = ""
If Range("R4").Value = "Payment" Then


selecting a whole column is the same as selecting a whole row
LastCol = cells(1,Columns.Count).end(xltoleft).Column
columns((LastCol + 1) & ":" & (Lastcol + 1)).Select

selecting individual cells in a column
set MyRange = Range(cells(1,"A"),(LastRow,"A"))
for each cell in MyRange

if not isempty(cell) then


end if

next cell


"nk" wrote:

Sorry... your codes were working. I found it was another problem. I raised
another question with title "How to select cells in specific Columns?". I
would appreciate it if you could take a look at it, too. Thank you.

"Joel" wrote:

I'm not usre what you are asking. The LastRow is checking column "A" to
determine where the last row of data is located. You can change "A" to any
column.

You code is copying only the row that is active. Is you want more than one
row then do the following:

from:
ActiveCell.EntireRow.Select
selection.Copy
to:
Range(ActiveCell, ActiveCell.Offset(2, 0)).EntireRow.Copy

Note: Your original code could of been done in one row
ActiveCell.EntireRow.Copy

"nk" wrote:

Thank you, Joel.

However, the code seems to past only first row which has "Payment" in column
S in "JGB" sheet.
It does not past the rest 3 rows.
Is anything else need to be added?

Thank you for help again.

nk

"Joel" wrote:

Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Activate
LastRow = Cells(Rows.Count, "A").End(xlup).Row
Rows((LastRow + 1) & ":" & (LastRow + 1)).Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


"nk" wrote:

Hello,

I am tring to copy the entire row from one sheet and past as value to
another sheet. Since I need to continue this for all the rows which meet
conditions I set up, I need to move rows to past all of them.

The codes I have now a


Sheets("JGB").Select
Range("A4").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Offset(0, 18).Value = "Payment" Then

'If ActiveCell.Offset(0, 18).Value = "Payment" Then

Application.CutCopyMode = False
ActiveCell.EntireRow.Select
selection.Copy

Sheets("JGB Coupon Sort").Select
Rows("2:2").Select
selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("JGB").Select

Else

End If

ActiveCell.Offset(1, 0).Select

Loop


With the codes above, I will keep pasting rows in the same row... I think I
need to use something like

Selection.Insert Shift:=xlDown

but this does not past data as value.

Could anyone please show me how to insert the entire row as value?

Thank you.
nk



Reply
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
insert rows in a worksheet that do not change adjoining rows craigandmel Excel Discussion (Misc queries) 2 April 29th 08 10:26 PM
Insert rows: Formats & formulas extended to additonal rows Twishlist Excel Worksheet Functions 0 October 22nd 07 04:23 AM
Insert page breaks every 50 rows but do not include hidden rows Martin[_21_] Excel Programming 5 March 12th 07 05:10 PM
How do i insert of spacer rows between rows in large spreadsheets laurel Excel Discussion (Misc queries) 0 April 24th 06 01:38 PM
Copy Rows and insert these rows before a page break AQ Mahomed Excel Programming 0 June 8th 04 09:09 AM


All times are GMT +1. The time now is 05:05 PM.

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"