Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Copying a cell value to a different sheet with a macro

To populate a combo box using validation a value of a cell on another sheet
(a job name) is copied to another sheet within a macro. Once the jobname has
been pasted I am currently inserting another row so that the next time a
paste is done the jobname in the cell is not overridden. Please view code
below

Sheets("Job").Select
ActiveSheet.Unprotect
ActiveSheet.Range("C30").Select
'Selection.Locked = False
'Selection.FormulaHidden = False
ActiveSheet.Paste
'Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("B10").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

It works fine if I do not create a new row remming out the line
Selection.Insert Shift:=xlDown
but I lose the name of the last entry so the user cannot retrieve that job.
The error I get is

Run-time error 1004. Paste method of worksheet failed.

I then have to end. The paste happens before the insert row so I am
confused. Is there a fix or a different way of populating a combo box using
data validation?

Many thanks

Nathan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying a cell value to a different sheet with a macro

Sub FFFF()
Selection.Copy
Sheets("Job").Unprotect
Selection.Copy Destination:= _
Sheets("Job").Range("C30")
Sheets("Job").Range("C30").Insert Shift:=xlDown
Sheets("Job").Protect _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True
End Sub

Worked fine for me.

--
Regards,
Tom Ogilvy



"NathanG" wrote in message
...
To populate a combo box using validation a value of a cell on another

sheet
(a job name) is copied to another sheet within a macro. Once the jobname

has
been pasted I am currently inserting another row so that the next time a
paste is done the jobname in the cell is not overridden. Please view code
below

Sheets("Job").Select
ActiveSheet.Unprotect
ActiveSheet.Range("C30").Select
'Selection.Locked = False
'Selection.FormulaHidden = False
ActiveSheet.Paste
'Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("B10").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,

Scenarios:=True

It works fine if I do not create a new row remming out the line
Selection.Insert Shift:=xlDown
but I lose the name of the last entry so the user cannot retrieve that

job.
The error I get is

Run-time error 1004. Paste method of worksheet failed.

I then have to end. The paste happens before the insert row so I am
confused. Is there a fix or a different way of populating a combo box

using
data validation?

Many thanks

Nathan



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
How do I copying data from a cell on sheet to a diff cell/sheet Bowldiva120 Excel Worksheet Functions 1 March 21st 10 11:25 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM
MACRO for copying active sheet without using a certain name Tami[_4_] Excel Programming 3 July 27th 04 04:47 AM
Macro for copying named range to any sheet Cutter[_6_] Excel Programming 6 July 2nd 04 11:03 PM
copying sheet with macro mcrmike Excel Programming 2 January 7th 04 08:22 PM


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