Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro that uses a value as the range
Hi,
I am wondering if anyone could shed some light on how i can program a value say in A1 that is constantly changing, and use the value as the destination to paste information on another sheet. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro that uses a value as the range
This sets c as the object variable for a value in sheet 2 that equals the
value in A1 of sheet 1. It then copies someRange designated by the user to a destination that is two cells to the right of the cell with the found value of c. Sub findValueA1() Dim c As Range Set someRange = Sheets(1).Range("C5") '<<<Change to need Set c = Sheets(2).Cells.Find(Sheets(1).Range("A1").Value _ LookIn:=xlValues) '<<<add additional parameters in needed. If Not c Is Nothing Then Sheets(1).Range(someRange).Copy Sheets(2) _ c.Offset(0, 2) End If End Sub "jpbat1591" wrote: Hi, I am wondering if anyone could shed some light on how i can program a value say in A1 that is constantly changing, and use the value as the destination to paste information on another sheet. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro that uses a value as the range
Say we want to put a message in Sheet2
Sheet1, cell A1 contains Z100 (the destination address) Sheet2, cell A2 contains the message: "Klaatu barada nikto" Here is a sample macro: Sub gort() Set a1 = Range("A1") Set a2 = Range("A2") destin = a1.Value a2.Copy Sheets("Sheet2").Range(destin) End Sub -- Gary''s Student - gsnu200798 "jpbat1591" wrote: Hi, I am wondering if anyone could shed some light on how i can program a value say in A1 that is constantly changing, and use the value as the destination to paste information on another sheet. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to select range from active cell range name string | Excel Programming | |||
Macro deletes row in range, macro then skips the row moved up | Excel Discussion (Misc queries) | |||
Macro to copy a specified range to a variable range | Excel Programming | |||
Macro won't execute when "For Each 'range' in 'range'" is added | Excel Programming | |||
Macro to input formula in range based on another range | Excel Programming |