I am trying to replace 558899 this Id number from below URL with cell value that is ID_NO = ws.Range("A1").Value.
"15.156.352.352/api/Book/GetOrBookID?Id=558899&ColumnName=PrimaryId"
and i changed it to
"15.156.352.352/api/Book/GetOrBookID?Id=" & ID_NO & "ColumnName=PrimaryId"
But it does not work nay help will be appreciated.
Your question doesn't mention what the bad result is, but I can see one issue in your code:
"15.156.352.352/api/Book/GetOrBookID?Id=" & ID_NO & "ColumnName=PrimaryId"
When this is parsed, it will result in:
"15.156.352.352/api/Book/GetOrBookID?Id=xxxxColumnName=PrimaryId"
But I think you want:
"15.156.352.352/api/Book/GetOrBookID?Id=xxxx&ColumnName=PrimaryId"
So the code you need is:
"15.156.352.352/api/Book/GetOrBookID?Id=" & ID_NO & "&ColumnName=PrimaryId"
Im guessing that the cell value is formatted as a number(long). therefore you could try replacing ID_NO with str(ID_NO) to convert it to a string
Related
I need to extract the following portion CDA-CUP-PF from the following string of
MECH~CDA-CUP-PF~1 - CUP0915.2XL - Copper Reducer (P)
text
AddFormula TopLeft.Offset(1, 3).Resize(RowCount, 1), "=IFERROR(RIGHT(AA" & Row & ",FIND(""~"",AA" & Row & ")-1,FIND(""^"",AA" & Row & ")+1-FIND(""-"",AA" & Row & ")),"""")"
This is what I see right now: MECH^CHU
I need to see this: CDA-CUP-PF
I need to use something like the VBA code above.
Assuming your pattern is isolating the text in between ~ a formula solution is:
=MID(A1,FIND("~",A1)+2,FIND("~",A1,FIND("~",A1)+1)-FIND("~",A1)-3)
A VBA - UDF solution would look something like this
Public Function Isolate(x As Range)
Dim xString: xString = Split(x, "~")
Isolate = xString(1)
End Function
This formula will do what you want: =TRIM(MID(SUBSTITUTE(A1,"~",REPT(" ",255)),255,255))
It works by replacing ~ with 255 spaces, then it carves out 255 characters from 255 characters in (Which guarantees we get what you want) then it trims off the spare spaces.
If you want the other parts, use left or right instead of mid.
The UDF is a much better option though especially as you are doing this from code already.
I'm using Excel 2010 and have a vba statement that works using hardcoded range limits, as below
Range(Range("F2"), Range("F" & lrow)).Value = "=INDEX('Acc plan'!$D$2:D300,MATCH(sageTB!$A$2:A300,'Acc plan'!$A$2:A300))"
I'd like to replace the value of 300 with a variable, but so far have failed miserably to get a version that doesn't just result in hash NAME in the results cell. Any tips would be very welcome
I have an Excel file that must work for english & french computer.
I need to concatenate dates in the format yyyy-mm-dd, so for my english user, I need to do:
="your date = "&TEXT(A1,"yyyy-mm-dd")
That works, but not in french Excel, where I need to do
="your date = "&TEXT(A1,"aaaa-mm-jj")
How can I print the same date to both my users, independently of theirs Excel langage locale?
English TEXT function vs French TEXTE function.
And yes, the date format string are localized...
To get the date in right format use:
=YEAR(A1) & "-" & RIGHT("0" & MONTH(A1),2) & "-" & RIGHT("0" & DAY(A1),2)
I found this link which seems to treat your issue :
If you are using the TEXT worksheet function because it is part of a larger formula, then you can instruct the function itself to use a different language for its output. You do this by including a language code (formally called an LCID) within brackets, in this manner:
=TEXT(A1,"[$-409]mmmm, yyyy")
Where you could specify the text to display according to the language you want.
I used to cope with this issue as follow assuming you're on a eng MSExcel:
1. I create a named formula (returns true when it's a fr region MSExcel)
name: xlFR
refers to: = text(Today(),"d") = "d"
click OK
2. in your formula you decide on xlFR
ex: = Text(today(), if(xlFR,"jj-mm-aaaa","dd-mm-yyyy") )
That's it.
Hope this helps.
I use this vba function in my formulas:
Function DateToText(MyDate As Date)
DateToText = Format(MyDate, "DD/MM/YYYY")
End Function
I debug in code, and I see that the value is in correct format, it just get and set the value only, and it seem like excel take the data as datetime instead of normal string,
I try to use NumberFormat and format it to either 1 of this (#, text, number, general) neither 1 is working, any help will be great
ActiveSheet.Range("D" & i).Value = arr(i, 4)
Update 1
Sorry to not mention arr, arr is multi dimension array, it store the column that I read from , I just get the value from excel, and the store in range by looping
Try this
ActiveSheet.Range("D1").Value = "'" & arr(1, 4)
I found the solution, although it look stupid
I change the format to
.NumberFormat = "yyyy/mm/dd"
and I get the value I want
I am trying to generate a customer number using the first three letters of the customers last name, the first name initial and middle initial, followed by the last four of their phone number. How would I do this? All I need is the formula.
First_Name Middle_Initial Last_Name Street_Address City State Zip Phone
Nathaniel E. Conn 6196 View Ct Lancing TN 37770 567-273-3956
Something like this (assuming a table with [structured-references], fill in the actual cell names if not):
=LEFT([LastName] & "---", 3)
& LEFT([FirstName] & "-", 1)
& LEFT([MiddleInitial] & "-", 1)
& RIGHT([PhoneNumber] & "----", 4)
I have used dashes ("-") to fill in any spaces where the field might be smaller than the number of characters you need from it. You can change them to any fill character that suits you.
Well, it depends on if each piece of data has its own column, looks like it does.
You can use the left/right functions to parse the data out of your columns.
=CONCATENATE(RIGHT(C1,3) & LEFT(A1,1) & LEFT(B3,1) & RIGHT(H1,4))
I would do:
=MID(CELL_LAST_NAME;1;3)&MID(CELL_FIRST_NAME;1;1)&MID(CELL_MIDDLE_NAME;1;1)&MID(CELL_PHONE;LEN(CELL_PHONE)-3;4)