Copy data not format

C

cakonopka

Hi there all

I have got thsi to work now:

Private Sub CommandButton1_Click()
Range("D18").Copy Destination:=Worksheets("Custome
Details").Range("C18")
Range("A1").ClearContents

End Sub

byut i only want it to copy the data not the format of the cell i wan
it to use the format that is already there, any ideas?

cheers

from C
 
F

Frank Kabel

Hi
try
Private Sub CommandButton1_Click()
Range("D18").Copy
Worksheets("Customer Details").Range("C18").PasteSpecial
Paste:=xlPasteValues
Range("A1").ClearContents
end sub

Frank
 
K

Kevin Beckham

use
Range("D18").Copy
Worksheets("Customer Details").Range("C18") _
.PasteSpecial xlPasteValues

Kevin Beckham
 
E

Ed

I do it like:
Range("D18").Copy
Range("C18").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

HTH
Ed
 
C

cakonopka

Hi there

Says there is a problem with the
Paste:=xlPasteValues

any ideas what?

says something mainly about the := bit

cheers

from C
 
C

cakonopka

Hi there

I have got to this stage

Private Sub CommandButton1_Click()
Range("D18").Copy
Worksheets("Customer Details").Range("C18").Select
Selection.PasteSpecial , Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=xlNone
Range("D18").ClearContents

End Sub

the only thing is it doesent work when i enter the different worksheet
bit as u can see above, after the copy bit, nay idea why?

cheers

from CK
 
J

John McGimpsey

One way:

Worksheets("Customer Details").Range("C18").Value = _
Range("D18").Value
 
C

cakonopka

HI THERE ALL

HERE IS WHER I AM AT THE MONENT

Private Sub CommandButton1_Click()
Range("D16").Copy
Worksheets("Customer Details").Range("B18").Value = _
Range("D16").Value

I HAVE A SERIES OF THESE FOR THE CELLS SO WHEN I PRESS THE BUTTON AL
THE DATA GOES INTO THE TABLE

ALL I NEED IT TO DO NOW IS TO ADD A NEW ROW IN A T THE TOP AND MOVE TH
OTHER DATA DOWN SO THE NEXT DATA IS INSERTED INTO THE NEW ROW, AN
IDEAS ON THIS LAST PROBLEM THEN ILL BE SO KIND AS TO LEAVE U VER
CLEVER PEOPLE ALONE, LOL

CHEERS

FROM C
 
K

Kevin Beckham

If you can, re-write to avoid using Select or ActiveCell
in your code
It will run faster and with fewer errors
(because you'll explicitly point to the cells being
operated upon).
For instance, in your code
Range("D18").Copy
will be that cell on the active sheet. If you change sheets
then the cell now points to the new active sheet
Worksheets("Customer Details").Range("C18").Select
fails because that sheet is not active
Either put
Worksheets("Customer Details").Activate
before it, or (MUCH, MUCH better)
Worksheets("Customer Details").Range("C18") _
.PasteSpecial , Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=xlNone

This line references the cell without activating the sheet

Kevin Beckham
 
K

Kevin Beckham

Worksheets("Customer Details").Range
("B18").EntireRow.Insert
Worksheets("Customer Details").Range("B18").Value = _
Range("D16").Value

no need to copy the cell with the code above.

Kevin Beckham
 
Top