Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default refer to a cells value in a macro

Is it possible to refer to the cell address generated within a cell to
specify a location to paste.

The macro below pastes all the data to cell (S27). I need the data to be
pasted to the Value in cell (S27) not the cell itself. The formula already in
this cell generates a cell address, currently ($s$28) and this will be
changed by the user each time the macro is ran.

Do I need to enter the word value somewhere???

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 24.02.2005
'

'
Range("C20:O22").Select
Selection.COPY
Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("N11").Select
Application.CutCopyMode = False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default refer to a cells value in a macro

You cannot have a formula and a value in the same cell. Once you paste a
value in, the formula is lost.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"loulou" wrote in message
...
Is it possible to refer to the cell address generated within a cell to
specify a location to paste.

The macro below pastes all the data to cell (S27). I need the data to be
pasted to the Value in cell (S27) not the cell itself. The formula already

in
this cell generates a cell address, currently ($s$28) and this will be
changed by the user each time the macro is ran.

Do I need to enter the word value somewhere???

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 24.02.2005
'

'
Range("C20:O22").Select
Selection.COPY
Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Range("N11").Select
Application.CutCopyMode = False
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default refer to a cells value in a macro

loulou,

Replace:

Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

with

Range(Range("S27").Value).PasteSpecial PASTE:=xlValues

HTH,
Bernie
MS Excel MVP

"loulou" wrote in message
...
Is it possible to refer to the cell address generated within a cell to
specify a location to paste.

The macro below pastes all the data to cell (S27). I need the data to be
pasted to the Value in cell (S27) not the cell itself. The formula already

in
this cell generates a cell address, currently ($s$28) and this will be
changed by the user each time the macro is ran.

Do I need to enter the word value somewhere???

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 24.02.2005
'

'
Range("C20:O22").Select
Selection.COPY
Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Range("N11").Select
Application.CutCopyMode = False
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default refer to a cells value in a macro

Sorry Bob I wasn't very clear.
I realise that cannot have a formula and a value in the same cell.

What I need the macro to do is to use the cell address generated within the
formula of cell (S27) which is ($S$28), and to paste the data there.

Thanks for your reply.

"Bob Phillips" wrote:

You cannot have a formula and a value in the same cell. Once you paste a
value in, the formula is lost.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"loulou" wrote in message
...
Is it possible to refer to the cell address generated within a cell to
specify a location to paste.

The macro below pastes all the data to cell (S27). I need the data to be
pasted to the Value in cell (S27) not the cell itself. The formula already

in
this cell generates a cell address, currently ($s$28) and this will be
changed by the user each time the macro is ran.

Do I need to enter the word value somewhere???

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 24.02.2005
'

'
Range("C20:O22").Select
Selection.COPY
Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Range("N11").Select
Application.CutCopyMode = False
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default refer to a cells value in a macro

Thank you very much Bernie it works like a dream!!!

"Bernie Deitrick" wrote:

loulou,

Replace:

Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

with

Range(Range("S27").Value).PasteSpecial PASTE:=xlValues

HTH,
Bernie
MS Excel MVP

"loulou" wrote in message
...
Is it possible to refer to the cell address generated within a cell to
specify a location to paste.

The macro below pastes all the data to cell (S27). I need the data to be
pasted to the Value in cell (S27) not the cell itself. The formula already

in
this cell generates a cell address, currently ($s$28) and this will be
changed by the user each time the macro is ran.

Do I need to enter the word value somewhere???

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 24.02.2005
'

'
Range("C20:O22").Select
Selection.COPY
Range("S27").Select
Selection.PasteSpecial PASTE:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Range("N11").Select
Application.CutCopyMode = False
End Sub




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
refer to two cells for location yhoy Excel Discussion (Misc queries) 8 February 9th 09 05:44 PM
how to find cells that refer to data in other cells in excel Aman Excel Discussion (Misc queries) 8 December 2nd 07 10:02 PM
Using cells to refer to worksheets Rup1776 Excel Worksheet Functions 1 September 27th 06 09:36 AM
To get a lot of charts that refer to different cells Anderson Lee Charts and Charting in Excel 1 December 28th 04 02:35 PM
Refer to three cells to populate For next hotherps[_33_] Excel Programming 0 April 5th 04 11:37 PM


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