Required excel formula or vba code to get updating dynamic values to the fixed text ranges

Sathish G

New Member
Joined
Aug 16, 2017
Messages
44
Office Version
  1. 2013
Platform
  1. Windows
hi all,

i need some experts help to get updating dynamic values to the fixed specific text ranges.

Note: Reference text ranges wont changed that is in sheet1, Only dynamic values will get changes all the time that is in sheet2.
 

Attachments

  • fixed text ranges_sheet1.JPG
    fixed text ranges_sheet1.JPG
    128 KB · Views: 15
  • Dynamic value_sheet2.JPG
    Dynamic value_sheet2.JPG
    72.6 KB · Views: 15

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try
VBA Code:
Sub InsertValue()
Dim Sh1 As Worksheet, Sh2 As Worksheet, k$
Dim LR1&, LR2&, Ta&, Tb&, T&
Dim Frng As Range
Application.ScreenUpdating = False
Set Sh1 = Sheets("Sheet1"): Set Sh2 = Sheets("Sheet2")
LR1 = Sh1.Range("A" & Rows.Count).End(xlUp).Row
LR2 = Sh2.Range("A" & Rows.Count).End(xlUp).Row
ReDim A(2 To LR2, 1 To 2)
For Tb = 2 To LR2
A(Tb, 1) = Sh2.Range("A" & Tb)
A(Tb, 2) = Left(A(Tb, 1), Len(A(Tb, 1)) - 2) & Sh2.Range("B" & Tb) & Right(A(Tb, 1), 2)
Next Tb
    With Sh1
    For Ta = 2 To LR1
    k = .Range("A" & Ta)
        For Tb = 2 To LR2
        If k = A(Tb, 1) Then .Range("A" & Ta) = A(Tb, 2)
        Next Tb
    k = ""
    Next Ta
    End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
or as a formula:

Book2
A
1<?xml version="1.0" encoding="UTF-8"?>
2<Section type="site" Name="dynamic value">
3<Chapter Name="Node Parameters">
4<Chapter Name="Project settings">
5<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>
6<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>
Sheet1

----------------
Book2
ABC
1Refrence test fixed dynamic valueresult
2<Section type="site" Name="dynamic value">5GEA1102<Section type="site" Name="5GEA1102">
3<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>AAY-HIS-DFFH-681232<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>
4<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>Activate<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>
Sheet2
Cell Formulas
RangeFormula
C2:C4C2=IFNA(IF(MATCH(A2,Sheet1!A:A,0)>0,SUBSTITUTE(A2,B1,B2),""),"")
 
Upvote 0
hi Srini,

Thanks a lot it working for me.

But small modification code required

For example in line 5 value imported as ""AAY-HIS-DFFH-681232/> instead of "AAY-HIS-DFFH-681232"/>

""> --- This condition importing fine
""/> --- This condition correction required.

<?xml version="1.0" encoding="UTF-8"?>
<Section Type="site" Name="5GEA1102">
<Chapter Name="Node parameters">
<Chapter Name="Project settings">
<Parameter Name="ProjectID" Role="PM" Value=""AAY-HIS-DFFH-681232/>
<Parameter Name="TPDEditableMode" Role="PM" Value="Activate">
 
Upvote 0
or as a formula:

Book2
A
1<?xml version="1.0" encoding="UTF-8"?>
2<Section type="site" Name="dynamic value">
3<Chapter Name="Node Parameters">
4<Chapter Name="Project settings">
5<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>
6<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>
Sheet1

----------------
Book2
ABC
1Refrence test fixed dynamic valueresult
2<Section type="site" Name="dynamic value">5GEA1102<Section type="site" Name="5GEA1102">
3<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>AAY-HIS-DFFH-681232<Parameter Name="ProjectID" Role"PM" value="dynamic value"/>
4<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>Activate<Parameter Name="EditableMode" Role="PM" Value="dynamic value"/>
Sheet2
Cell Formulas
RangeFormula
C2:C4C2=IFNA(IF(MATCH(A2,Sheet1!A:A,0)>0,SUBSTITUTE(A2,B1,B2),""),"")

Thanks a lot for your efforts but actually am looking vba code to update everything automatically.
 
Upvote 0
Try
VBA Code:
Sub InsertValue()
Dim Sh1 As Worksheet, Sh2 As Worksheet, k$
Dim LR1&, LR2&, Ta&, Tb&, T&, m&
Dim Frng As Range
Application.ScreenUpdating = False
Set Sh1 = Sheets("Sheet1"): Set Sh2 = Sheets("Sheet2")
LR1 = Sh1.Range("A" & Rows.Count).End(xlUp).Row
LR2 = Sh2.Range("A" & Rows.Count).End(xlUp).Row
ReDim A(2 To LR2, 1 To 2)
For Tb = 2 To LR2
A(Tb, 1) = Sh2.Range("A" & Tb)
If Right(A(T, 1), 2) = "/>" Then m = 3 Else m = 2
A(Tb, 2) = Left(A(Tb, 1), Len(A(Tb, 1)) - m) & Sh2.Range("B" & Tb) & Right(A(Tb, 1), m)
Next Tb
    With Sh1
    For Ta = 2 To LR1
    k = .Range("A" & Ta)
        For Tb = 2 To LR2
        If k = A(Tb, 1) Then .Range("A" & Ta) = A(Tb, 2)
        Next Tb
    k = ""
    Next Ta
    End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
script out of range on this line

If Right(A(T, 1), 2) = "/>" Then m = 3 Else m = 2
 
Upvote 0
script out of range on this line

If Right(A(T, 1), 2) = "/>" Then m = 3 Else m = 2
Many thanks to you!!!

Script worked fine after made this correction

If Right(A(Tb, 1), 2) = "/>" Then m = 3 Else m = 2
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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