Looking for a simple VBA.
DATA is in the Input sheet and gets the output as in OutputX, OutputY, and OutputZ.
Looking for a simple VBA.
DATA is in the Input sheet and gets the output as in OutputX, OutputY, and OutputZ.
I cleaned up the "Input"t sheet (double commas ",,"", erroneous subset numbers!)![]()
Please Login or Register to view this content.
Last edited by JohnTopley; 08-28-2022 at 11:14 AM.
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
Thank you. But if I change the dealer information (in column B)with a long text introduction with the address there then I find an issue in the line:
xstr = xstr & Mid(ar(i, 2), n1, n2 - n1) 'ouput for "outputx".
For example the problem occurs when I put the below Delear information in column B
Dealer information:
(1)State State State State State State State State State State, State State
State State, State State State State State State, State State
State State State State, State State State State, State, State.
(2)State State State State State State State State State, State State
State State, State State State State State State, State State
State State State Staten, State State State State, State, State; State State
State State State, State State State State State State,
State, State. State State: State.
Last edited by first_jaguar; 09-01-2022 at 04:19 PM.
Making use of your actual supplied file...This produces the exact result you expected...
Am away again for a while...Will check in again when available...![]()
Please Login or Register to view this content.
Good Luck...
I don't presume to know what I am doing, however, just like you, I too started somewhere...
One-day, One-problem at a time!!!
If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
Also....Add a comment if you like!!!!
And remember...Mark Thread as Solved...
Excel Forum Rocks!!!
Thank you but this line gets highlighted in yellow: OutX(x, 2) = IIf(OutX(x, 2) = "", Mid(Info, Pos1, Pos2), OutX(x, 2) & Mid(Info, Pos1, Pos2))
The code runs perfectly for me...Have you changed anything in the file...
Yes Sir...I added the multi-paragraph "Dealer information:" with their numbers and I got this problem
Also if the dealer name is say John W Smith in output cells it becomes JohnwSmith. "o va R(2)" becomes "ovaR(2)".
Last edited by first_jaguar; 09-02-2022 at 06:06 AM.
So...upload the file with the changed data so we can see...
You need to remember the code is written for your exact request...The code provided gave the exact result you provided for that supplied file...
If you go and change the data or it's layout, then it is obvious that the code will not work...
Please find the attachment with the Demo text. Hope you will understand.
There are many rows in the original data.
Code errors because you do not have closing brackets for (2)
No sample output provided!
Also if the dealer name is say John W Smith in output cells it becomes JohnwSmith. "o va R(2)" becomes "ovaR(2)".
I got my solution thanks, everyone.
Last edited by trueb; 09-02-2022 at 07:09 AM.
Attached solves...Tx for rep +Also if the dealer name is say John W Smith in output cells it becomes JohnwSmith. "o va R(2)" becomes "ovaR(2)".
Post a sample file with the 50+ dealer groups / product/contact
Last edited by JohnTopley; 09-12-2022 at 01:10 PM.
Sir, The first attached file has 6 dealers in the group in row cell A2. If I copy the same multiple times and make 50 different names by simple modification the VBA is not working. The VBA works for a max of up to 7 members in a dealer group. And there can be 50+ members in a dealer group.
Try this change to code:
![]()
Please Login or Register to view this content.
It worked. Thank you....but I faced another problem.
If o va R(2)(9)(10)(11)(12)(13)(14)(15)(16)(17)(18)(19)(20) is like this then
Run time error 5
Invalid procedure call or argument
clicking debug highlights this line
Now where can I make a change ?![]()
Please Login or Register to view this content.
See if this solves...
Last edited by Sintek; 09-14-2022 at 02:53 AM.
I have found an issue:
(#) to (#) should work copying whatever is in between them.
I mean if there are ";" ":" etc characters between (#) to (#) in any cell in the Input sheet then the VBA asks to debug.
Here, # means numbers inside brackets. Also in place of numbers if brackets are with (#) or (;|-), etc then also the VBA can not run.
try
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks