gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I need to move data from one sheet to another but some of the data needs to be transformed when its moved
1) I have a table that has three columns (Source Type, Type, Subcatagory). The table name is "Source_Type" and its on a table named "Source Type"
For the code below where I have Type; what I need to do is take the value thats in Sheets("3 Enter Quote Data").Range("I12").Value and look up the value in the table. I12 is the Source Type. Can you lookup a value in VBA? I would like to have the lookup in the code.
2) For the Escalation Base Date
I need to convert the value that is Sheets("3 Enter Quote Data").Range("R12").Value which is a date to MM/yyyy
"Escalation Base Date", each Date.ToText([To Date],"MM/yyyy"))
3) For the Escalation Rate
I need to concatenate the value in Sheets("3 Enter Quote Data").Range("L7").Value the Year from the "To Date" which is the value in Sheets("3 Enter Quote Data").Range("I12").Value
[IHS_Code]&"-"&Number.ToText([Year])
Any help is very much appreciated
Thank You!
1) I have a table that has three columns (Source Type, Type, Subcatagory). The table name is "Source_Type" and its on a table named "Source Type"
For the code below where I have Type; what I need to do is take the value thats in Sheets("3 Enter Quote Data").Range("I12").Value and look up the value in the table. I12 is the Source Type. Can you lookup a value in VBA? I would like to have the lookup in the code.
2) For the Escalation Base Date
I need to convert the value that is Sheets("3 Enter Quote Data").Range("R12").Value which is a date to MM/yyyy
"Escalation Base Date", each Date.ToText([To Date],"MM/yyyy"))
3) For the Escalation Rate
I need to concatenate the value in Sheets("3 Enter Quote Data").Range("L7").Value the Year from the "To Date" which is the value in Sheets("3 Enter Quote Data").Range("I12").Value
[IHS_Code]&"-"&Number.ToText([Year])
Any help is very much appreciated
Code:
Sub AddtoTemplate1()
Dim TPLR As Long
TPLR = Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Cost Sources").Range("A" & LR).Value = Sheets("3 Enter Quote Data").Range("F15").Value
Sheets("Cost Sources").Range("B" & LR).Value = "Part"
'Type
Sheets("Cost Sources").Range("C" & LR).Value = Sheets("3 Enter Quote Data").Range("I12").Value 'Need to lookup the value in table
Sheets("Cost Sources").Range("D" & LR).Value = Sheets("3 Enter Quote Data").Range("L5").Value
Sheets("Cost Sources").Range("E" & LR).Value = Sheets("3 Enter Quote Data").Range("P5").Value
Sheets("Cost Sources").Range("F" & LR).Value = Sheets("3 Enter Quote Data").Range("O12").Value
'To Date
Sheets("Cost Sources").Range("G" & LR).Value = Sheets("3 Enter Quote Data").Range("R12").Value
Sheets("Cost Sources").Range("H" & LR).Value = "(Common)"
Sheets("Cost Sources").Range("I" & LR).Value = Sheets("3 Enter Quote Data").Range("F5").Value
Sheets("Cost Sources").Range("J" & LR).Value = Sheets("3 Enter Quote Data").Range("F17").Value
Sheets("Cost Sources").Range("K" & LR).Value = Sheets("3 Enter Quote Data").Range("P17").Value
' Escalation Base Date
'Sheets("Cost Sources").Range("M" & LR).Value =?
' Escalation Rate
'Sheets("Cost Sources").Range("M" & LR).Value = ?
End Sub
Thank You!