Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculate, Copy, Paste

Need help with a macro I can not for some reason get to work what I am
trying to do is copy a cell "AC12" and the paste it to "A1" and
then calculate "rand() " and copy "AC12" again and then paste
to column A2 and then repeat the same procedure 10, 50, 200 times if
wanted. I have no problem editing the macro for the number of times I
want to calculate, copy and paste. Is it also possible to calculate,
copy and paste a number of cells say "AC12, AC21, AC28, AC33" etc.
and then paste all to column A this is what works now but I have to
calculate (PressF9) every time before I copy , paste Thanks in Advance

Range("AC12").Select
Selection.Copy
Range("A1").Select
Selection.End(xlDown).Select
ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculate, Copy, Paste

thanks don we are half way there..lol any way i need to calculate
"RAND()" every time before i copy and paste to "A1" and yes your macro
is MUCH better then mine if only i can get it to calculate RAND() which
means that every time i run RAND() i will get a new set of numbers to
copy and paste to "column A"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calculate, Copy, Paste

Sub copyvalue()
Dim n as Long, i as Long, x as Long
n = 12
for i = 1 to n
x = Cells(Rows.Count, "a").End(xlUp).Row + 1
Cells(x, "a").Value = Range("ac12")
Application.Calculate
Next
End Sub

For "AC12, AC21, AC28, AC33"
Sub copyvalue()
Dim rng as Range, i as Long, x as Long, j as Long
Dim cell as Range, n as Long
n = 12
set rng = Range("AC12, AC21, AC28, AC33")
for i = 1 to n
x = Cells(Rows.Count, "a").End(xlUp).Row + 1
j = 0
for each cell in rng
Cells(x + j, "a").Value = rng.Value
j = j + 1
Next
Application.Calculate
Next
End Sub

Would be a guess.

--
Regards,
Tom Ogilvy'


wrote in message
ups.com...
thanks don we are half way there..lol any way i need to calculate
"RAND()" every time before i copy and paste to "A1" and yes your macro
is MUCH better then mine if only i can get it to calculate RAND() which
means that every time i run RAND() i will get a new set of numbers to
copy and paste to "column A"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Calculate, Copy, Paste


Sweet !!! thanks tom..having a problem with your second macro though
its posting 4 like numbers in column A every time it calutates..thanks
agin



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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 10:39 AM.

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"