Hi,
I'm new to Macro's , i got a macro to Define names and functions from a sheet Range to Name Manager ; the code is as below
Sub Button2_Click()
Dim wb As Workbook
Dim ws As Worksheet
Dim sWsName As String
Dim sWbName As String
Set wb = ActiveWorkbook
Set ws = ActiveSheet
sWsName = ws.Name
sWbName = wb.Name
Dim St1, St2, St3, St4, In5 As Integer
Dim Inp1, GetString, ExtString As String
St1 = Range("F3").Value
St2 = Range("F5").Value
Inp1 = Range("D3").Value
St4 = St1
For counter = St1 To St2
Dim ExtArray() As String
St3 = Inp1 & CStr(St4)
ExtString = Range(St3).Value
ExtArray() = Split(ExtString, "=")
wb.Names.Add Name:=ExtArray(0), RefersTo:=ExtArray(1)
Range("G20").Value = ExtArray(0)
Range("G21").Value = ExtArray(1)
St4 = St4 + 1
Next
End Sub
What i had tried to do is ,
get the range from cell D3(F3-F5) ie., D3 = K , F3 = 10 , F5 = 20 ,
then range list is to take K10:K20 strings and delimited by = (by split function)
which forms name = function ;
but unfortunately, the function added in the name manager has "" , (like name="function" , where name=function was defined as string in K10-K20 range, which kills the usage the name manager.
can someone guide to eliminate the "" in this code.
Bookmarks