Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy and past as values

Hi
I am new to vba and macros. need urgent help
In Sheet 1, I am trying to copy a cell C1 and paste as values in cell D1 and
then from C2 to D2. The function needs to progress in this fashion one by
one. I want to create a macro and still be able to run it from a different
worksheet say Sheet 2.

Kindly help

Regards
Piyush
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Copy and past as values

Try

Sub copy()
Dim myRange As Range
Set myRange = Sheets("sheet1").Range("C1:C20") ' Change to suit
For Each c In myRange
c.Offset(0, 1).Value = c.Value
Next
End Sub


Alt +F11, Insert module and paste code in.

Mike

"Piyush" wrote:

Hi
I am new to vba and macros. need urgent help
In Sheet 1, I am trying to copy a cell C1 and paste as values in cell D1 and
then from C2 to D2. The function needs to progress in this fashion one by
one. I want to create a macro and still be able to run it from a different
worksheet say Sheet 2.

Kindly help

Regards
Piyush

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Copy and past as values

You can copy the code below and paste it into the standard code
module by pressing Alt + F11. If the code module is dark, then
on the menu InsertModule and then paste the code in.
You can assign a keyboard shortcut to run the code or run it by
clicking ToolsMacroMacros and then selecting this macro before
clicking Run:

Sub cpy()
lr = Worksheets(1).Cells(Rows.Count, 3).End(xlUp).Row
' Gets the last used row number. If your data is in
' a different sheet change the number (1) to the
' appropriate index number.
For Each c In Worksheets(1).Range("$C$2:$C" & lr)
c.Copy
c.Offset(0, 1).PasteSpecial Paste:=xlValues
Next
Application.CutCopyMode = False
End Sub


"Mike H" wrote:

Try

Sub copy()
Dim myRange As Range
Set myRange = Sheets("sheet1").Range("C1:C20") ' Change to suit
For Each c In myRange
c.Offset(0, 1).Value = c.Value
Next
End Sub


Alt +F11, Insert module and paste code in.

Mike

"Piyush" wrote:

Hi
I am new to vba and macros. need urgent help
In Sheet 1, I am trying to copy a cell C1 and paste as values in cell D1 and
then from C2 to D2. The function needs to progress in this fashion one by
one. I want to create a macro and still be able to run it from a different
worksheet say Sheet 2.

Kindly help

Regards
Piyush

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 and Past Values AND Formatting AND Text KKD Excel Discussion (Misc queries) 1 May 6th 10 06:25 PM
Copy Past Values Ed Davis[_2_] Excel Discussion (Misc queries) 13 October 6th 09 03:24 AM
Copy and Past Joe Excel Discussion (Misc queries) 1 August 17th 06 02:10 AM
Referential Copy and Past Bob Excel Programming 2 March 28th 06 04:48 PM
Copy and past to different sheets zgclub Excel Discussion (Misc queries) 4 February 9th 06 11:58 AM


All times are GMT +1. The time now is 02:20 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"