Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Variable Cell Value within a macro

I have a limited ability with macros. I record them rather than write them.

What I'm trying to do is write a macro that will copy a cell value and paste
it to another sheet. Sounds simple. But the location it needs to be pasted is
a variable row with a fixed column.

I have a cell on sheet 1 (F7) which details the cell to go to in sheet 2
(R?C33) (?= variable row).

Can anyone advise.

Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Variable Cell Value within a macro

Option Explicit
sub testme()
dim DestCell as range
dim OrigCell as range

set origcell = worksheets("sheet1").range("f7")

with worksheets("sheet2")
set destcell = .cells(.rows.count,33).end(xlup).offset(1,0)
end with

origcell.copy _
destination:=destcell

'or
destcell.value = origcell.value
end sub

I used the next available row in column 33.

Ron (Bismark) wrote:

I have a limited ability with macros. I record them rather than write them.

What I'm trying to do is write a macro that will copy a cell value and paste
it to another sheet. Sounds simple. But the location it needs to be pasted is
a variable row with a fixed column.

I have a cell on sheet 1 (F7) which details the cell to go to in sheet 2
(R?C33) (?= variable row).

Can anyone advise.

Many thanks.


--

Dave Peterson
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
Cell References [email protected] Excel Discussion (Misc queries) 2 November 15th 06 11:37 PM
How to set variable to cell value in excel macro most xlent Excel Discussion (Misc queries) 6 October 27th 05 06:52 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 08:24 AM.

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"