Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

move cell contents over one column

Status
Not open for further replies.

sidetech

Technical User
Jan 27, 2009
23
0
0
US
i have a a macro button that runs
ActiveCell.FormulaR1C1 = "=(RANDBETWEEN(1000,9999))"
what i would like it to do is copy the cell to the next column before the rand runs. all the cells are in column D
and need to copy to E, same row.
the macro record shows this
Range("D6").Select
Selection.Copy
Range("E6").Select
ActiveSheet.Paste
End Sub
Sub Macrotest4()
'
' Macrotest4 Macro
'

'
Selection.Copy
Range("E3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
i can't figure out how to make the range move with the active cell.
Thank you
 


Hi,

Do you want to paste the formula or the VALUES?

Here's how to paste formula and all
Code:
    Range([D6], [D6].end(xldown)).Copy
    Range("E6").PasteSpecial xlPasteAll


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thank you Skip and sorry i wasn't more clear.
the random value in column D, i would like copied to column E but before the random number changes.
the worksheet is like this
location name type number previous number
AXI joe HR 1234 (copy here)
i would need to select which cell in column D would need to change not all need to change.
then hit the button to change the number.
i was wondering if i could add something before this
ActiveCell.FormulaR1C1 = "=(RANDBETWEEN(1000,9999))"
to make the active cell copy the values over one column.
sorry if i'm not explaining things right.
Thank you
 


Any chage that you do will force a calculation UNLESS you make Calculation xlManual.


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thank you
Yes, Calculation is set to manual.
the field needs to stay the same until a new hire comes in.
 
Something like this ?
Code:
...
ActiveCell.Offset(0, 1) = ActiveCell.Value
ActiveCell.FormulaR1C1 = "=(RANDBETWEEN(1000,9999))"
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top