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
 

p45cal

Well-known Member
Joined
Nov 10, 2009
Messages
4,763
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:

eawachte

New Member
Joined
Jan 14, 2011
Messages
29
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
 

Forum statistics

Threads
1,082,382
Messages
5,365,129
Members
400,825
Latest member
Sreekanth_21

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top