Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default copy cell values only

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default copy cell values only

cells(2+off,"F").Value = Cells(r,2).resize(1,2).Value


"tkraju via OfficeKB.com" wrote:

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default copy cell values only

Patrick,
I changed the code,but I didn't get desired results.this has permanently cut
the values from the column 2 and pasted the values in column F

"Patrick Molloy" wrote:

cells(2+off,"F").Value = Cells(r,2).resize(1,2).Value


"tkraju via OfficeKB.com" wrote:

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default copy cell values only

well the "F" was in your code as the target cell

the correct syntax is


with Source
Target.Resize( .Rows.Count, .Cols.Count ).Value = .Value
End With

where both Source and Target are defined and set as ranges

"TUNGANA KURMA RAJU" wrote:

Patrick,
I changed the code,but I didn't get desired results.this has permanently cut
the values from the column 2 and pasted the values in column F

"Patrick Molloy" wrote:

cells(2+off,"F").Value = Cells(r,2).resize(1,2).Value


"tkraju via OfficeKB.com" wrote:

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default copy cell values only

Just a typo alert.

..cols.count
should be
..columns.count



Patrick Molloy wrote:

well the "F" was in your code as the target cell

the correct syntax is

with Source
Target.Resize( .Rows.Count, .Cols.Count ).Value = .Value
End With

where both Source and Target are defined and set as ranges

"TUNGANA KURMA RAJU" wrote:

Patrick,
I changed the code,but I didn't get desired results.this has permanently cut
the values from the column 2 and pasted the values in column F

"Patrick Molloy" wrote:

cells(2+off,"F").Value = Cells(r,2).resize(1,2).Value


"tkraju via OfficeKB.com" wrote:

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1



--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default copy cell values only

Sub extractData()
Dim sName As String
Dim dDate As Date
Dim Ammount As Double
Dim LastRow As Long
Dim off As Long

LastRow = Range("A" & Rows.Count).End(xlUp).Row
sName = Range("D1").Value
dDate = Range("E1").Value
For r = 2 To LastRow
If Format(Cells(r, 2), "mm-yy") = Format(dDate, "mm-yy") Then
If Cells(r, 1).Value = sName Then
Cells(r, 2).Resize(1, 2).Copy Cells(2 + off, "K")
Cells(r, 6).Resize(1, 2).Copy Cells(2+ off, "M")
off = off + 1
End If
End If
Next
End Sub

Well this is my code.I am getting problem in that second line
copying.Cells(r, 6) means Col F and G values be copied to Col M and N,where
as Col F and G values formula based result values,thus I am getting different
values in Col M and N.
I need Contents of Col F and G are to be copied to Col M and N.

"Patrick Molloy" wrote:

well the "F" was in your code as the target cell

the correct syntax is


with Source
Target.Resize( .Rows.Count, .Cols.Count ).Value = .Value
End With

where both Source and Target are defined and set as ranges

"TUNGANA KURMA RAJU" wrote:

Patrick,
I changed the code,but I didn't get desired results.this has permanently cut
the values from the column 2 and pasted the values in column F

"Patrick Molloy" wrote:

cells(2+off,"F").Value = Cells(r,2).resize(1,2).Value


"tkraju via OfficeKB.com" wrote:

Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default copy cell values only

Hi

I think this is what you need:

Cells(r,2).Resize(1,2).Copy
Cells(2+off,"F").PasteSpecial xlPasteValues

Regards,
Per

"tkraju via OfficeKB.com" <u16627@uwe skrev i meddelelsen
news:949a30b4f01c7@uwe...
Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line
to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default copy cell values only

Thank you Per Jessen,
this code is yours,I think you have not seen my reply in OfficeKb.
this problem is almost over,now it is pasting values only ,the bug is last
row cells still in selected state, and last source(copy) cells still blinking
around.

"Per Jessen" wrote:

Hi

I think this is what you need:

Cells(r,2).Resize(1,2).Copy
Cells(2+off,"F").PasteSpecial xlPasteValues

Regards,
Per

"tkraju via OfficeKB.com" <u16627@uwe skrev i meddelelsen
news:949a30b4f01c7@uwe...
Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to copy
cell values(contents) only.What changes I need to do the above code line
to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default copy cell values only

Hi

Haven't seen your last reply, will look at it tomorrow.

Add this after the "Next" statement to turn off "marching ants":

Application.CutCopyMode=False

Regards,
Per

"TUNGANA KURMA RAJU" skrev i
meddelelsen ...
Thank you Per Jessen,
this code is yours,I think you have not seen my reply in OfficeKb.
this problem is almost over,now it is pasting values only ,the bug is last
row cells still in selected state, and last source(copy) cells still
blinking
around.

"Per Jessen" wrote:

Hi

I think this is what you need:

Cells(r,2).Resize(1,2).Copy
Cells(2+off,"F").PasteSpecial xlPasteValues

Regards,
Per

"tkraju via OfficeKB.com" <u16627@uwe skrev i meddelelsen
news:949a30b4f01c7@uwe...
Cells(r,2).Resize(1,2).Copy Cells(2+off,"F")
The above code copying cell values and formulas.My requirement is to
copy
cell values(contents) only.What changes I need to do the above code
line
to
copy cell contents only.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200904/1




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
Copy values from a cell based on values of another cell Spence10169 Excel Discussion (Misc queries) 4 January 13th 09 10:01 AM
Copy values to a different cell Kanga 85 Excel Worksheet Functions 2 December 10th 08 06:01 PM
VAB to copy cell values into new Sheet, Overwrite if needed and based off of Cell Value in a column gumby Excel Programming 4 July 14th 07 01:55 AM
copy cell values to another workbook FurRelKT Excel Programming 1 December 1st 06 09:56 PM
How do I copy cell values in VBA Jurado Excel Programming 0 June 30th 05 11:57 PM


All times are GMT +1. The time now is 08:31 AM.

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"