Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Len Len is offline
external usenet poster
 
Posts: 162
Default Find Copy Paste Special

Hi,

The following codes work but does not copy paste special value ( ie
copy value without formula )
Several attempts to modify it but it fails

Extract of codes : -

With Worksheets("BS Grp")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "10A" Then
iNextRow = iNextRow + 1
.Rows(i).Copy Worksheets("Sheet3").Cells(iNextRow,
"A").PasteSpecial xlPasteValues
End If
Next i
End With
Sheets("Sheet3").Columns.AutoFit

Any help would be appreciated and thanks
I'm excel vba beginner

Regards
Len


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Find Copy Paste Special

On Sun, 10 Jan 2010 06:55:17 -0800 (PST), Len
wrote:

Hi,

The following codes work but does not copy paste special value ( ie
copy value without formula )
Several attempts to modify it but it fails

Extract of codes : -

With Worksheets("BS Grp")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "10A" Then
iNextRow = iNextRow + 1
.Rows(i).Copy Worksheets("Sheet3").Cells(iNextRow,
"A").PasteSpecial xlPasteValues
End If
Next i
End With
Sheets("Sheet3").Columns.AutoFit

Any help would be appreciated and thanks
I'm excel vba beginner

Regards
Len



The code seems to work if you just make a new line after the Copy.
Like this:

..Rows(i).Copy
Worksheets("Sheet3").Cells(iNextRow,"A").PasteSpec ial xlPasteValues

Hope this helps / Lars-Åke
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Find Copy Paste Special

I just tested this fine.

Option Explicit
Sub CopyValues()
Dim i As Long
Dim ilastrow As Long
Dim inextrow As Long
With Worksheets("sheet10")
ilastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To ilastrow
If .Cells(i, "A").Value = "10A" Then
inextrow = inextrow + 1
.Rows(i).Copy
Worksheets("Sheet11").Cells(inextrow, "a") _
.PasteSpecial xlPasteValues
End If
Next i
End With
Sheets("Sheet3").Columns.AutoFit
End Sub
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Len" wrote in message
...
Hi,

The following codes work but does not copy paste special value ( ie
copy value without formula )
Several attempts to modify it but it fails

Extract of codes : -

With Worksheets("BS Grp")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "10A" Then
iNextRow = iNextRow + 1
.Rows(i).Copy Worksheets("Sheet3").Cells(iNextRow,
"A").PasteSpecial xlPasteValues
End If
Next i
End With
Sheets("Sheet3").Columns.AutoFit

Any help would be appreciated and thanks
I'm excel vba beginner

Regards
Len



  #4   Report Post  
Posted to microsoft.public.excel.programming
Len Len is offline
external usenet poster
 
Posts: 162
Default Find Copy Paste Special

On Jan 10, 11:13*pm, "Don Guillett" wrote:
I just tested this fine.

Option Explicit
Sub CopyValues()
Dim i As Long
Dim ilastrow As Long
Dim inextrow As Long
With Worksheets("sheet10")
* * ilastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
* * For i = 1 To ilastrow
* * If .Cells(i, "A").Value = "10A" Then
* * inextrow = inextrow + 1
* * .Rows(i).Copy
* * Worksheets("Sheet11").Cells(inextrow, "a") _
* * .PasteSpecial xlPasteValues
* * End If
* * Next i
* * End With
* * Sheets("Sheet3").Columns.AutoFit
End Sub
* * * If desired, send your file to my address below. I will only look if:
* * * 1. You send a copy of this message on an inserted sheet
* * * 2. You give me the newsgroup and the subject line
* * * 3. You send a clear explanation of what you want
* * * 4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Len" wrote in message

...



Hi,


The following codes work but does not copy paste special value ( ie
copy value without formula )
Several attempts to modify it but it fails


Extract of codes : -


With Worksheets("BS Grp")
* *iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
* *For i = 1 To iLastRow
* *If .Cells(i, "A").Value = "10A" Then
* *iNextRow = iNextRow + 1
* *.Rows(i).Copy Worksheets("Sheet3").Cells(iNextRow,
"A").PasteSpecial xlPasteValues
* *End If
* *Next i
* *End With
* *Sheets("Sheet3").Columns.AutoFit


Any help would be appreciated and thanks
I'm excel vba beginner


Regards
Len- Hide quoted text -


- Show quoted text -


Hi All,

Thanks your prompt reply
I didn't realise it just a simple mistake that cause an error in
running my codes
thanks anyway

Regards
Len
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
Special Copy, Paste Special macro usmc-r70 Excel Programming 3 July 2nd 09 08:12 AM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
Find first empty cell in column J. Copy, paste special, value from zzxxcc Excel Programming 12 September 12th 07 10:34 PM
copy, find next blank row, paste special location Pete Excel Programming 3 March 20th 05 12:45 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


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

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

About Us

"It's about Microsoft Excel"