View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default 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.