ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update value of variable from one sheet to paste into another shee (https://www.excelbanter.com/excel-programming/374335-update-value-variable-one-sheet-paste-into-another-shee.html)

tibbs

Update value of variable from one sheet to paste into another shee
 
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.


Bill Pfister

Update value of variable from one sheet to paste into another shee
 
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


"tibbs" wrote:

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.


Tom Ogilvy

Update value of variable from one sheet to paste into another shee
 
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



--
Regards,
Tom Ogilvy


"tibbs" wrote:

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.


tibbs

Update value of variable from one sheet to paste into another shee
 
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.

"tibbs" wrote:

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.


tibbs

Update value of variable from one sheet to paste into another
 
Thanks very much, this is an excellent support page.

"Tom Ogilvy" wrote:

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



--
Regards,
Tom Ogilvy


"tibbs" wrote:

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.



All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com