Update value of variable from one sheet to paste into another shee

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could somebody please tell me how to select a specific cell and store the
text string of the cell into a string variable.

I then want to seach for the string on another sheet and paste into the cell
on the RH side of the cell that was searched for.

e.g

Dim i As String

ActiveSheet.Range("A1").Select
i = ActiveCell.FormulaR1C1

' search for i on another sheet.

Sheets("Standards").Select
Cells.Find (i)
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1=i

Is this correct ?
I'm pretty new at this and have had no training.

Thanks for any help you can provide.
 
Once you find the cell, you need to select it:
Cells.Find(i).select

Then things should work. Are you certain the value you are looking for will
always exist on your "Standards" sheet?

Bill
 
Sub Findit()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim s As String, rng As Range
Set sh1 = Activesheet
Set sh2 = Worksheets("Standards")
s = sh1.Range("A1")
Set rng = sh2.Cells.Find(What:=s, _
After:=sh2.Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.Offset(0, 1) = s
Else
msgbox s & " wasn't found on Standard"
End If
End Sub
 
Thats great thanks, I'm using it in a macro to select standard pages for an
electrical drawing from a spreadsheet. The final list will be imported into a
cad package as a .prn file to create electrical drawings automatically from
the standards sheets.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top