Define Variable then paste value followed by text to a cell

eawachte

New Member
Joined
Jan 14, 2011
Messages
29
I am in one workbook and offset and select a cell. I take the value from that go to another workbook and want to paste that value plus some constant text after that. I can not seem to get it to work. I have used something similar to what is below, but it worked just fine.

Workbooks(NEWFN2).Activate
ActiveWorkbook.Sheets("Input Data").Range("A3:IS3").Find(RunNumber).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, 5).Select
CamberWT = Selection.Value


Workbooks(Pull).Activate
'This is what will not work for me
ActiveWorkbook.ActiveSheet.Range("J15").Value = Selection.Value & " " & "Wheel Travel"
End Sub

Any help is greatly appreciated!!

Thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
try changing:
= Selection.Value & " " & "Wheel Travel"
to:
=CamberWT & " " & "Wheel Travel"

or replacing the entire code you gave with:
Code:
Set zzz = Workbooks(NEWFN2).Sheets("Input Data").Range("A3:IS3").Find(RunNumber)
If Not zzz Is Nothing Then
    Workbooks(Pull).Activate
    ActiveWorkbook.ActiveSheet.Range("J15").Value = zzz.Offset(1, 5).Value & " " & "Wheel Travel"
End If
and if you knew the name of the sheet in the Pull workbook:
Code:
Set zzz = Workbooks(NEWFN2).Sheets("Input Data").Range("A3:IS3").Find(RunNumber)
If Not zzz Is Nothing Then Workbooks(Pull).Sheets([COLOR=#ff0000]"NameOfSheetHere"[/COLOR]).Range("J15").Value = zzz.Offset(1, 5).Value & " " & "Wheel Travel"
 
Last edited:
Upvote 0
Thank you!! The second option worked.

I did accidentally post the wrong code (which addressed your first option) I had

Workbooks(NEWFN2).Activate
ActiveWorkbook.Sheets("Input Data").Range("A3:IS3").Find(RunNumber).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, 5).Select
CamberWT = Selection.Value


Workbooks(Pull).Activate
'This is what will not work for me
ActiveWorkbook.ActiveSheet.Range("J15").Value = CamberWT & " " & "Wheel Travel"
End Sub

I'm really confused why this doesn't work. I had done this exact code before and it worked fine. Any ideas why?

Thanks so much for the help!

Gene
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top