Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Just testing a before a possible Thread post. No reply needed

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    My Testies: Just testing before a possible Thread post. No reply needed

    Test test

    _____ Workbook: ProAktuellex8600x2Sort1.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    T
    U
    V
    W
    X
    16691
    118
    0.2
    7.8
    3.1
    3.1
    34
    0.1
    16692
    123
    0.2
    7
    8.7
    8.5
    30
    0.1
    0
    16693
    120
    0.2
    7.4
    5.7
    5.7
    32
    0
    0.1
    16694
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16695
    118
    0.2
    7.8
    3.1
    3.1
    34
    0
    0
    0.1
    16696
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16697
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16698
    119
    0.2
    7.5
    5.1
    5.1
    33
    0
    0.1
    16699
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16700
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    0
    0
    16701
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16702
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16703
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16704
    117
    0.2
    7.7
    3.1
    3.1
    34
    0.1
    16705
    123
    0.2
    7
    8.9
    8.9
    30
    0.1
    16706
    117
    0.2
    7.8
    3.1
    3.1
    34
    0.1
    16707
    117
    0.2
    7.7
    3.1
    3.1
    34
    0.1
    16708
    120
    0.2
    6.9
    8.4
    8.4
    30
    0.1
    0
    0
    16709
    321
    17
    19
    10
    1.8
    24
    0
    0.3
    16710
    121
    0.2
    6.9
    8.8
    8.8
    30
    0.1
    16711
    300
    6.8
    29
    16
    8.7
    17
    0
    0.3
    0.1
    16712
    233
    7.3
    15
    13
    5.2
    16
    0.1
    0
    16713
    186
    0.8
    19
    12
    11
    28
    0.1
    0.2
    0.1
    Worksheet: Sheet1
    Attached Files Attached Files
    Last edited by DocAElstein; 03-11-2019 at 02:20 AM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10
    Hi Jeff,
    Why have you deleted this Thread_...
    http://imgur.com/m17fPbU ( http://www.excelforum.com/hello-intr...-thoughts.html )
    _.. which you started?, as well as my Reply:



    Quote Originally Posted by jeffreybrown View Post
    I guess I know the answer, but doesn't mean I actually want to do it, especially to a member with so many years, posts, and the title of Forum Expert.
    http://www.excelforum.com/excel-gene...la-needed.html
    I know there shouldn't be any exceptions, but I suppose infractions are warranted!....
    Hi Jeff,
    I do not quite understand what you are asking?
    ( The OP said he was unable to change the Title. http://www.excelforum.com/excel-gene...ml#post4591186 )

    Are you suggesting that Special-K should be given an infractions for continuing after your Moderator's message?

    If so I think the issue that needed to be addressed first is with the OP and why he is / was unable to change the Title. Just my Opinion.. I think you should have followed that up. http://www.excelforum.com/excel-gene...ml#post4591186 Just my Opinion.. ***

    But I do agree that a good title is very important. That is one rule that I do feel is very important.
    _.....


    ***
    _ Possibly the OP was posting at a time when there were software problems making editing difficult ( he mentions the dreaded spinning wheel that we all hate so much ).
    Or
    _ He is using one of the Forum styles other than default. Sometimes not all options are available in all styles:......
    ForumStyles.JPG http://imgur.com/hKhyE8M
    http://www.excelforum.com/the-water-...ml#post4543964
    http://www.excelforum.com/the-water-...ml#post4543988
    http://www.excelforum.com/the-water-...ml#post4544280

    _Also as a new OP -he may not yet be able to Edit posts!
    duckersjNewOpIsMatey.JPG http://imgur.com/tTubchA
    ( I beleive such things may be restricted for new users to help prevent spammers joining and making a mess )


    Alan


    P.s. Do you realise that you are posting this http://www.excelforum.com/hello-intr...-thoughts.html in the Sub Forum (Off Topic) Hello..Introduce yourself ?
    JeffHelloIntroduceInfractionsWonk.JPG http://imgur.com/m17fPbU
    I do not think that is the appropriate Sub Forum. ( Probably Water Cooler or Suggestions for Improvement or Feedback / Comments / Suggestions etc. But just my opinion. I do not think you should receive an infraction for incorrect posting.. Lol... – Possibly just a negative reputation would do .. Lol... --- seeking anyone's thoughts ??
    Attached Files Attached Files
    Last edited by DocAElstein; 02-25-2017 at 07:05 PM. Reason: Just using Post agian for different test

  3. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    Pop Up User InputBox with range selection alternative with API User 32 dll Programs Non Modal MessageBox

    Recursion Procedures in Excel VBA. Recursion technique in coding

    Procedures Calling others
    I think this can be very easy to understand. I think it has been made unnecessary hard to understand by two things:
    _ (i) The usual initial explanation or definition : …. ..” A procedure that calls itself is a recursive procedure…” – forget that it is rubbish
    _ (i) if you are familiar with stepping through a code in the VBEditor using F8 debug mode, ( http://www.eileenslounge.com/viewtop...247121#p247121 ) , then you might be confused into believing _ (i) if you step through coding which goes into recursion.

    Procedures Calling others
    A procedure ( also known as code , coding , or routine, or program ) is just a set of instruction which are followed when it “runs
    A procedure Calling another procedure is quite common in even simple programming. This just means that a running procedure has a code line that instructs another procedure to start. The technical term is that the original procedure Calls another.
    What may not be immediately obvious, is that
    _ a) generally VBA coding can only do one procedure at a time.
    _ b) for a simple Calling of a procedure from another, the procedure doing the Calling will pause , whilst the Called procedure runs. When that Called procedure Ends , then the original paused procedure will carry on from the point where it paused, which will necessarily be the Call point

    These points might not be so obvious by looking at the coding in the VB Editor window. For example, below is an initial code passing some information to a second procedure which it Calls
    Those actual “procedures” are just instructions. You could consider those as your master copy, or on the other hand you might just consider them as one of many possible copies: There is nothing to stop you storing copies of all that all over the place, on computers, on paper etc… in any case, VBA will have made a note of where these instructions are. When you start the first code running, VBA will make a copy of the instructions ( Sub1 ) and run that. When VBA then reaches the code line Call Sub2(CpyNo:=StrtCpyNo, Msg:="Initial Message") , it will pause Sub1 , while it makes a copy of the second procedure instructions, Sub2 , and it will run through those instructions until they are finished, at which point it resumes Sub1 at the Call code line.

    If you go unto the VBEditor ( Via keys Alt+F11 from Excel ) , then click anywhere in Sub1 and hit key F8 , then you will proceed in step mode through the coding. If you bear in mind the points _ a) and _ b) , then you might be able to follow and understand what is going on.
    Code:
    Option Explicit
    Sub Sub1()
    Dim StrtCpyNo As Long ' To count copy number of code instructions being run
     Let StrtCpyNo = 1
     
     
     
     Call Sub2(CpyNo:=StrtCpyNo, Msg:="Initial Message")
     
     MsgBox Prompt:="Ending main procedure"
    End Sub
    ' Code above is Main calling procedure_________________________________________________________________________________
    
    ' Code below is called procedure
    Sub Sub2(ByVal CpyNo As Long, ByVal Msg As String)
    Dim CopyNo As Long ' This is to indicate which copy of Sub2 is currently running
     Let CopyNo = CpyNo
     MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo
     
     MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo
    End Sub
    Because the first routine pauses whilst the second routine is done, we could attempt to write the equivalent single routine, which progresses through the same steps, in the same order as when the above coding is run by starting Sub 1
    Code:
    Sub Sub1Sub2()
    Dim StrtCpyNo As Long
     Let StrtCpyNo = 1
     
      
    'Call Sub2( CpyNo:=StrtCpyNo,                    Msg:="Initial Message")
    ' Sub 2
    Dim CpyNo As Long: Let CpyNo = StrtCpyNo: Dim Msg As String: Let Msg = "Initial Message"
    Dim CopyNo As Long
     Let CopyNo = CpyNo
     MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo
       
     MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo
    ' End Sub2
     
     MsgBox Prompt:="Ending main procedure"
    End Sub
    Some things to note, before moving onto recursion things.. :
    _ It is very easy to loose track of where you are when procedures Call others. It is particularly difficult to keep track when you are stepping through coding experiencing recursion processes. The reason for this is the following: As mentioned, the written coding is just copies of instructions. If you are doing any sort of debugging, such as the step F8 mode, then Microsoft has decided to indicate for you where you are in the copies shown in the VB Editor. That is not too bad for the coding shown so far. The problem comes in a recursion process, where, in this case, our Sub2Calls itself”.
    What would be sensible for Microsoft to do in that case would be to show you a new copy of Sub2 , and step you through that second copy. Unfortunately that does not occur. Instead it shows you going through the same copy of Sub2
    Therefore as you go through such a recursion process you will never know in which copy you are running
    _ Following on from the last point: I don’t think I have ever experienced using recursion routines where it has not been useful to have an integer variable which keeps track of what copy I am in. I would personally recommend always to have such a variable
    In the coding shown so far, this is my variables CopyNo and CpyNo
    So far they have always been 1, as I have only been running 1 copy of Sub2
    As we proceed, it should be clear how we can arrange that the variable always has a number equal to the copy number of the second routine, Sub2 , which is currently running
    Last edited by DocAElstein; 03-04-2019 at 11:03 PM. Reason: Just testing

  4. #4
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10
    I am thinking of an alternative approach, the idea being to reduce on the steps to reorganising the array at every swap stage.. the idea came from 2 things …

    _1 The recursion routine is fed currently the row indices of the rows that need to be sorted.
    _2 We can use the VBA Application.Index Method allows us to re sort an array “ in one go “ via a code line like , pseudo formula..

    arrOut() = App.Indx( ArrIn() , {1;3;2} , {1,2,3} )
    arrOut() = App.Indx( ArrIn() , row indices , column indicies )

    The above code line would change an arrIn() like this …_
    A b c
    D e f
    G h I
    _ … to a given output in arrOut() like this:
    A b c
    G h I
    D e f

    So the idea is that we sort the indices values, and then re apply the formula above

    At this stage I propose modifying the existing code so as to have a better chance of a direct comparison in performance.. Both will be then subject to similar general inefficiencies arising from the very opened out explicit form of the codings generally

    Here the basic modifications for Sub SimpleArraySort7(__ , Sub TestieSimpleArraySort7()

    Global Variables
    To help simplify the comparison and so reduce the changes to the routines, I will have a couple of Global variables at the top of the module and outside any routine for the row and column indices
    Dim Cms() As Variant, Rs() As Variant
    This will allow me to refer to, that is to say change and use, in any copy of the recursion routine. (It would also be an alternative place here at the top of the module and outside any routine for our main array, arrTS(): we could then always refer to this, and then not need the ByRef arsRef() at the signature line of the recursion routine. But for now I will leave that as it is for closer comparison of the routines )
    To help in the development of this coding and to help with the explanation here, I have also moved the variable for the test range, RngToSort , to the top of the module and outside any routine to make it a global variable: This way I can use it’s dimensions to position intermediate paste outs of the arrTS(). For example , I have added a section immediately after the end of the main outer loop == for sorting, ' Captains Blog, Start Treck , which pastes out the current state of the sorted array , arrTS(), along with the current state of the indices, Rs()
    Code:
    ' Captains Blog, Start Treck
     Let RngToSort.Offset((RngToSort.Rows.Count * (CopyNo + 1)), 0).Value = arsRef()
     RngToSort.Offset((RngToSort.Rows.Count * (CopyNo + 1)), -1).Resize(UBound(Rs(), 1), UBound(Rs(), 2)).Value = Rs()
     Debug.Print " Running Copy " & CopyNo & " of routine." & vbCr & vbLf & "  Sorted rows " & strRws & " based on values in column " & Clm & vbCr & vbLf & "   Checking now for Dups in that last sorted list" & vbCr & vbLf
    For color=Blue]Sub[/color] SimpleArraySort7(__ I will also include a new array variable , as a global variable, arrIndx(). This I will fill by the formula line of
    arrIndx() = Application.Index(arrIndx(), Rs(), Cms())

    Modifying indices values in main sort loop sorting
    The way the current coding is organised this is fairly simple. We have sections where row elements are swapped. We use the row information in the variables rOuter and rInner. So quite simply, we do the same swap for row indices,


    Initial row indicees

    Evaluate(Row(1to15)).JPG : https://imgur.com/UVTQCYO


    Evaluate(Column(1to6)).JPG : https://imgur.com/jbaZdgJ
    Last edited by DocAElstein; 03-13-2019 at 02:07 PM.

  5. #5
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10
    Simple recursion example 2

    In simple general terms a recursion routine can be an efficient way to do a sort of looping while looking for something. Sometimes the idea of “tunnelling down” or digging down” can describe the situation well. Sometimes a standard looping routine of the Do Loop While type form can replace a recursion routine more efficiently ( https://www.excelforum.com/tips-and-...omparison.html )
    The characteristic that possibly distinguishes recursion routines is the ability to seemingly intelligently go up and down: Compare it to the situation of digging down , whereby from time to time you come back up a bit, then dig down again in a slightly different direction. That is best illustrated by using a recursion routine for one of its most common practical uses, that of searching through Folders and sub Folders in a Directory. That will be done in the over next post.
    As a pre requisite to that we will demonstrate how a much simpler recursion routine may dig down until a condition is met, and then, thereafter it comes back up, level for level , i.e. copy for copy. This usage is very similar to the standard looping routine of the Do Loop While type form except that you have a last coming back up the levels, or coming back up the copies, which you would not have with a simple Do Loop While type form ( https://www.excelforum.com/developme...ml#post4221234 )

    We did not experience this coming back up in the last code because we Stoped. In general use of a recursion process, we do not have a simple way to end with like If ____ Then End Sub. Such a solution would be difficult to implement in a recursion process, as we would be ending the current copy with the End Sub.
    So generally a recursion process ends by somehow “coming back up levels” or ending each copy one after the other, either
    in sequence for a simple routine,
    or
    after going back and forth / up and down in a more complicated implementation of a recursion process.

    In most cases the coming back up is rarely experienced. We have specifically a message box at that point to show when a copy of the routine is ended. In practical uses what happens at this point is ether nothing, or for more complex implementation of recursion, we may be in a Loop at that point which would determine if we “go back down” again: Some controlled looping at this point is what triggers the possibility to “go back down” , pseudo…

    Sub Sub2( CpyNo , ______ )
    CurrentCopyNumber=CpyNo


    __Do
    ___Call Sub2(CurrentCopyNumber+1 , ______ )
    __Loop While__
    MsgBox Prompt:="You are Ending Sub2 , copy " & CurrentCopyNumber
    End Sub


    This will be discussed in the over next post.
    For now we look at the simple case

    One immediate way to stop us going further than say the second copy, would be to change our last coding pair from…_
    Code:
    Sub Sub1()
    Dim StrtCpyNo As Long ' To count copy number of code instructions being run
     Let StrtCpyNo = 1
     
     
     Call Sub2(CpyNo:=StrtCpyNo, Msg:="Initial Message")
     
     MsgBox Prompt:="Ending main procedure"
    End Sub
    ' Code above is Main calling procedure '____________________________________________________________________
    
    ' Code below is called procedure
    Sub Sub2(ByVal CpyNo As Long, ByVal Msg As String)
    Dim CopyNo As Long ' This is to indicate which copy of Sub2 is currently running
     Let CopyNo = CpyNo
     MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo
     
    Call Sub2(CpyNo:=CopyNo + 1, Msg:="Message coming from Sub2, copy  " & CopyNo & "")
     MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo
    End Sub
    _... to
    Code:
    Sub Sub1()
    Dim StrtCpyNo As Long ' To count copy number of code instructions being run
     Let StrtCpyNo = 1
     
     
     Call Sub2(CpyNo:=StrtCpyNo, Msg:="Initial Message")
     
     MsgBox Prompt:="Ending main procedure"
    End Sub
    ' Code above is Main calling procedure '_____________________________________________________________________________
    
    ' Code below is called procedure
    Sub Sub2(ByVal CpyNo As Long, ByVal Msg As String)
    Dim CopyNo As Long ' This is to indicate which copy of Sub2 is currently running
     Let CopyNo = CpyNo
     MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo
    
         If CopyNo < 2 Then Call Sub2(CpyNo:=CopyNo + 1, Msg:="Message coming from Sub2, copy  " & CopyNo & "")
     MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo
    End Sub
    You can safely run the above coding, ( by running Sub1 ) , in normal mode, as it will no longer try to go on for ever. But it is probably more demonstrative to use debug F8 mode


    Here is an attempt to show the last run as Excel VBA actually experienced it, - running Sub1 followed by two separate copies of Sub2, or rather
    Start Sub1
    _Start Sub2Copy1
    ___Start Sub2Copy2
    ___End Sub2Copy2
    _End Sub2Copy2
    End Sub1

    Code:
    Sub Sub1Sub2Sub2()
    Dim StrtCpyNo As Long ' To count copy number of code instructions being run
     Let StrtCpyNo = 1
    
    
    'Call Sub2(CpyNo:=StrtCpyNo, Msg:="Initial Message")
    ' Sub2 Copy 1
    Dim CpyNo As Long: Let CpyNo = StrtCpyNo: Dim Msg As String: Let Msg = "Initial Message"
    Dim CopyNo As Long ' This is to indicate which copy of Sub2 is currently running
     Let CopyNo = CpyNo
     MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo
    
        If CopyNo < 2 Then
         'Call Sub2(CpyNo:=CopyNo+1, Msg:="Message coming from Sub2, copy  " & CopyNo & "")
         ' Sub2 Copy 2
        Dim CpyNo_ As Long: Let CpyNo_ = CopyNo + 1: Dim Msg_ As String: Let Msg_ = "Message coming from Sub2, copy  " & CopyNo & ""
        Dim CopyNo_ As Long ' This is to indicate which copy of Sub2 is currently running
         Let CopyNo_ = CpyNo_
         MsgBox Prompt:="You are Starting Sub2 , copy  " & CopyNo_
        End If
        If CopyNo_ < 2 Then
        Else
         MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo_
        End If
        'End Sub2 ' End Copy 2 of Sub2
     MsgBox Prompt:="You are Ending Sub2 , copy  " & CopyNo
    'End Sub2 ' End Copy 1 of Sub2
    
     MsgBox Prompt:="Ending main procedure"
    End Sub
    Last edited by DocAElstein; 03-06-2019 at 01:25 AM. Reason: Just testing

  6. #6
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10
    Quote Originally Posted by Rick Rothstein View Post
    .... this non-looping macro should also work...
    I sometimes wonder whether we fool ourselves into thinking that these things are non looping. I don’t think any of us is privy to exactly what Excel is doing behind the scenes when these things work. The lack of clear documentation to these “array” type workings and the little fiddles you have to do sometimes to get these to work, makes me wonder if anyone knows exactly what is going wrong. Here is one of not many theories about how these sort of things might work.. http://www.excelfox.com/forum/showth...on-and-VLookUp That might suggest that what happens with these Evaluate Range things is similar to how maybe the CSE Array Entry formulas work in spreadsheets:
    It suggests that we maybe “tap in” to something that gets done anyway whether we want to or not, and as such we don’t add too much extra. This something could be a “along the row, down a column, along a row…” type thing like a raster across an old telly screen which updates a complete screen/ worksheet. When we define the area in the initial selection of the spreadsheet area before adding our formula in a type 2 CSE Array Entry we may simply be exposing a large area rather than the usual single cell in a complete screen update. In other words the extra information for a multi cell range is there anyway and all we do is open up a bigger window so that we see it at once.
    As far as I know, Evaluate was / is something to let you construct a string using both Excel spreadsheet and VBA stuff and then evaluate that string as if you wrote it manually in a spreadsheet cell.
    Whether or not it was planned that it could be used in the way that people like Rick do as a sort of hidden type 2 CSE Array Entry formula , or whether that is an accident, I don’t know.

    I don’t think I have ever noticed that these things wont work as a type 2 CSE Array Entry , ( occasionally they don’t work in evaluate and we have to coerce them into working ) , so taking Ricks last masterpiece and putting it in a spreadsheet like this will confirm that it works
    Code:
    Dim LastRow As Long, strEval As String
     Let LastRow = Cells(Rows.Count, "A").End(xlUp).Row
     Let strEval = Replace(Replace("IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2:A#,"" "",""""),"","","""")),IF(LEFT(A1:A@,4)=""2018"",TRIM(A1:A@&"" ""&A2:A#),""""),IF(LEFT(A1:A@,4)=""2018"",A1:A@,""""))", "#", LastRow + 1), "@", LastRow)
     Range("B1:B" & LastRow).FormulaArray = "=" & strEval
     Debug.Print strEval 'IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2:A1," ",""),",","")),IF(LEFT(A1:A0,4)="2018",TRIM(A1:A0&" "&A2:A1),""),IF(LEFT(A1:A0,4)="2018",A1:A0,""))
    _____ Workbook: NormanOrrinFilter.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    B
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    2018, 1, 90515, 10024515, G9, SBlabla (HQ), CHE, BLABLA, blabla, 10012098, 12003.5
    12
    2018, 1, 90629, 10022334, P3, BLABLA blabla (blablabla), CHE, BLABLA,blabla, 10033609, 13941.72
    13
    2018, 1, 90709, 10020009, P4, Blabla og Blalala (NY), CHE, Blabla,Bla-ah, 10006098, 15392.64
    14
    15
    2018, 1, 90765, 10012123, P4, Ch of Blabla(Blabla of Blabla), CHE, BLA-BLA,Bla Blabla, 10005678, 16231.7
    16
    17
    2018, 1, 90712, 10022908, P4, Snr BLA Off (Strat BLa, BLA), CHE, BLABLA,Bla BLabla, 10023234 14900.28
    18
    19
    2018, 1, 90919, 10020984, P2, Ass BLA Balbla, CHE, BLA,Blabla, 10033098, 10486.33
    20
    2018, 1, 95706, 10023098, NB, Assc BLA Blabal (LatBLAa), BLA, BLABLABLA,Blabla, 10034318, 7566.31
    21
    22
    23
    24
    25
    26
    27
    28
    29
    2018, 1, 95716, 10018763, NA, Asst BLA Off (Blabla & Multi-BLa), BLA, BLA,Bla, 10097776, 8607.96
    30
    2018, 1, 99716, 10026132, G5, Snr BLA Asst (Bla Blabla), BLA, BLABLA,bla BLa, 18767043, 5477.44
    31
    2018, 1, 99716, 10016545, G6, Blabla Blabla (BLA), BLA, BLABLABLA,Blabla, 1097029, 5325.3
    32
    33
    Worksheet: Rick
    _.________________________________--

    I would guess that whoever wrote the .SpecialCells did that quite efficiently. Who knows, they may even have used some of this “hidden array “ techniques to do it.
    So a combination of .SpecialCells and evaluate range one liners sounds an attractive combination , in my opinion.

    _._________
    Coming back to the solution from Rick… I was interested to work through it.. so I did. I put my workings here, as the OP or anyone else viewing this thread might be interested.

    Alan
    Last edited by DocAElstein; 01-09-2019 at 01:47 AM.

  7. #7
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    ExtendingInsensibility into Code modules. Copy table contents to VBIDE VB Editor code modules

    Full demo code to accompany last post:
    Code:
    Option Explicit
    Sub ThisShouldWork()
    Dim LastRow As Long, strEval As String
     Let LastRow = Cells(Rows.Count, "A").End(xlUp).Row
     Let strEval = Replace(Replace("IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2:A#,"" "",""""),"","","""")),IF(LEFT(A1:A@,4)=""2018"",TRIM(A1:A@&"" ""&A2:A#),""""),IF(LEFT(A1:A@,4)=""2018"",A1:A@,""""))", "#", LastRow + 1), "@", LastRow)
     Debug.Print strEval ' Hit Ctrl+g from the VB Editor to get the Immediate window up.                                                                                              'IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2:A41," ",""),",","")),IF(LEFT(A1:A40,4)="2018",TRIM(A1:A40&" "&A2:A41),""),IF(LEFT(A1:A40,4)="2018",A1:A40,""))
    'This is the spreadsheet equivalent to Rick's Evaluate
     Range("B1:B" & LastRow).FormulaArray = "=" & strEval
    'This gives a demo of the actual formulas that Excel VBA does
     Range("J5:J44").Value = "=IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2,"" "",""""),"","","""")),IF(LEFT(A1,4)=""2018"",TRIM(A1&"" ""&A2),""""),IF(LEFT(A1,4)=""2018"",A1,""""))" ' Applying the fixed vector notation (Excel instructed to do that by no $s) will result in the same relative formula. Displayed will be the actual formula ( in the relative form, but that is not important)
      
    ' Final solution  Rick : http://www.excelfox.com/forum/showth...0888#post10888
      Range("A1:A" & LastRow) = Evaluate(Replace(Replace("IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A2:A#,"" "",""""),"","","""")),IF(LEFT(A1:A@,4)=""2018"",TRIM(A1:A@&"" ""&A2:A#),""""),IF(LEFT(A1:A@,4)=""2018"",A1:A@,""""))", "#", LastRow + 1), "@", LastRow))
    '  Range("A1:A" & LastRow).SpecialCells(xlBlanks).EntireRow.Delete ' This will mess up now due to my .FormulaArray  as you can't delete bits of that
    End Sub
    
    
    
    '          2018, 1, 90709, 10020009, P4, Blabla og Blalala (NY), CHE, Blabla,Bla-ah, 10006098, 15392.64
    '                        TRIM(A13" "&A14)
    
    '   IF(      True        ,   TRIM(A13" "&A14)        ,       A13       )
    
    
    '   IF(       ISNUMBER(0+1000609815392.64),   TRIM(A13" "&A14)        ,       A13       )
    '   IF(       ISNUMBER(0+SUBSTITUTE(10006098,15392.64),",","")),   TRIM(A13" "&A14)        ,       A13       )
    
    '   IF(       ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A14," ",""),",","")),   TRIM(A13" "&A14)        ,       A13       )           )
    '   IF(       ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A14," ",""),",","")), IF(LEFT(A13,4)="2018"  ,  TRIM(A13" "&A14)  ,  "")      ,     IF( LEFT(A13,4)="2018"  ,  A13  ,"" )     )
    
    
    '   IF(       ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A14," ",""),",","")), IF(LEFT(A13,4)="2018"  ,  TRIM(A13" "&A14)  ,  "")      ,     IF( LEFT(A13,4)="2018"  ,  A13  ,"" )     )
    '      IF(       ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A14," ",""),",","")),IF(LEFT(A13,4)="2018",TRIM(A13" "&A14),"")      ,     IF(LEFT(A13,4)="2018",A13,"")     )
    '            IF(ISNUMBER(0+SUBSTITUTE(SUBSTITUTE(A14," ",""),",","")),IF(LEFT(A13,4)="2018",TRIM(A13" "&A14),""),IF(LEFT(A13,4)="2018",A13,""))
    Last edited by DocAElstein; 01-09-2019 at 07:09 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  8. #8
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    Communication regarding my use of Test Forum at Excel Fox

    ( P.M. )
    Quote Originally Posted by Alan
    Hi Sam,
    I have quick question. I am asking if I may post codes , Tables, etc. in , for example your Test Area, and reference those Posts from other Forums.

    _.....The idea is basically similar to something I do already:...You may have noticed:..._..

    I current use this thread in your Test Area Sub Forum.
    http://www.excelfox.com/forum/showth...L-Tables-etc-)
    I reference codes or table or extended explanations there from other posts.
    I do this so as to have less clutter in the main Threads from which these “appendix” posts are referenced.

    I also do this over at ExcelForum, where these “appendix” Threads appear very popular
    http://www.excelforum.com/showthread.php?t=1101544
    http://www.excelforum.com/showthread.php?t=1148621
    http://www.excelforum.com/showthread.php?t=1147913
    http://www.excelforum.com/showthread.php?t=1154829
    Those are mainly used by me for “appendix” posts referenced by one or more reply posts I do when answering Threads at ExcelForum.
    Occasionally, I also reference those posts from other Forums.

    There is a disadvantage for me in using those Threads at ExcelForum.
    _ You must be logged in to view the Test Area at ExcelForum, so people who are not registered cannot vie them.
    _ You cannot use HTML anywhere at ExcelForum ( you have that enabled in your Test Sub Forum )
    _ ExcelForum is increasingly unavailable for long periods due to Software problems
    _ Many other software problems at ExcelForum , including viruses, are making people more and more reluctant to use the site.

    So, if I may, I would like to use in addition ( or possibly instead ) ExcelFox for some of my “appendix” Posts
    _......

    So, if may, I would like to post codes and the such that may not ( at least initially ) be relevant to Threads at ExcelFox. I will then post a link to those posts as appropriate in other Forums.
    I do not think it is appropriate for me necessarily to post in these in the Excel Tips and Tricks Sub Forum as the content may not be “stand alone”, that is too say the content may not be so meaningful on its own.
    ( I am only a part time “Exceller”, and a Novice at that – so I would never get anywhere near the Heights of the likes of Rick Rothstein oder Rajan Verma. – So there would never be the requirement for me to have my own “corner” )
    _.......

    ( By the way, I do this partly already: In my signature both at ExcelFox and ExcelForum
    http://www.excelfox.com/forum/showth...=9821#post9821
    I assumed that was OK as I am just referencing some Forum Posting Tools that I use in both Forums )



    Thanks
    Alan Elston.



    Quote Originally Posted by Alan
    Hi Admin,
    Thanks for the reply
    As I mentioned, I did not want an individual Forum. Indeed even if available, I would not think it appropriate for my posts.
    I was just wondering if I could post some of my stuff in the Test Area, for the reasons I mentioned:
    _ Posts that are not “stand alone” Tips and tricks are less suited to Tips, Tricks. They would be for me to reference to when answering specific Posts and Blogs elsewhere.
    _ In Test Forum I have HTML
    _ In Test forum I have unlimited Edit time.


    So the question was if, in addition to Tips and Tutorials, I may also post in the Test Area, in the fashion that I do, as indicated, at ExcelForum?
    http://www.excelforum.com/developmen...te-thanks.html
    http://www.excelforum.com/developmen...ly-needed.html
    http://www.excelforum.com/developmen...ly-needed.html


    _ The purpose of this will be following:
    Codes and Information , To be referenced in this web site , Also to be referenced from other web sites
    Thanks
    Alan
    Quote Originally Posted by Admin View Post
    No issues
    ( Per PM: )
    Quote Originally Posted by Admin
    No restriction in Test Area
    Last edited by DocAElstein; 03-01-2017 at 08:40 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  9. #9
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,313
    Rep Power
    10

    Test

    Example
    Post #3 Copy table contents to VBE module

    The idea of these codes are to allow for a temporary storage of spreadsheet values to a code module.
    _ One code will add a table of values to the end of a code module, and an extra start and end line will be added which contains range and date info. This code uses the selected range. So a range must be selected before running this code.
    and
    _ a second code can be used to paste those values back to the same range.
    Optionally a date of entry can be given to search for, otherwise all table values are pasted in

    The codes are somewhat detailed and inefficient. They work in many places “line by line”. There are some more simpler and more efficient codes here. http://www.eileenslounge.com/viewtop...=31395#p243002

    Sub PubProliferous_Let_RngAsString__()
    This code puts a selected range of values into the code module in which the code at the position of just after this coding. The table data values will be added to ( or taken from in following codes ) the module in which the code is run.
    Here a brief walk through the code. There are more details in the 'comments
    Rem 0 Sets for convenience, a variable to the code module in which the code is placed/ run from
    Rem 1
    A code module used for storing a table will be given the extension to its code name of "_txt" No special reason for doing this, I just thought it might be useful for later reference to know that the code module is being used in such a way. ( If no more table data is in the code module, then the extension , "_txt" , will be removed. This will be done , for example in following codes after the data is removed.)
    Rem 2
    Before running the code, a spreadsheet range should be selected. The range is copied to the clipboard, and the text of that put in a string variable, strIn
    Rem 3
    The string format is changes slightly to allow better display in this code ( and to aid in manipulation in the codes which re copy the data back to the spreadsheet, http://www.eileenslounge.com/viewtop...=31395#p242941
    Rem 4
    This adds an “extra line” to the start of the string with range information and current date, and an extra line at the end of the string with the same date. (I use date format of 10 digits as DD MM YYYY. ( This needs to be added to the data retrieving codes if looking for data from a specific date ) )
    As demo example, say I copied a 2 row x 2 cell range, B2:C3 to the clipboard. Say the range looked like this
    A B
    C D
    At this point in the routine, after Rem 4 , I will have in strIn , something of this approximate/pseudo form, ( say for a date of 12th December, 2018 ):
    Code:
    = " '_-20 12 2018 Worksheets("Tabelle2").Range("B2:C3") "  & vbCr & vbLf &  “|” &  “A”  &  “|” & “B” & vbCr & vbLf & “|” &  “C”  &  “|” & “D” & vbCr & vbLf &  “  '_-20 12 2018 “
    Rem 5
    The above string is converted to an array by splitting by the & vbCr & vbLf & . So effectively , I would end up with something of this form , for the above example , a 4 element, 1 Dimensional array:
    { SpltRws(0) , SpltRws(1) , SpltRws(2) , SpltRws(3) }
    where
    SpltRws(0) = " '_-20 12 2018 Worksheets("Tabelle2").Range("B2:C3") "
    SpltRws(1) = “|” & “A” & “|” & “B”
    SpltRws(2) = “|” & “C” & “|” & “D”
    SpltRws(3) = “ '_-20 12 2018 “



    Alan
    Last edited by DocAElstein; 12-21-2018 at 07:37 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  10. #10
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi Alan,

    Why don't you post the codes in the original thread ? Or are you testing the code over here ?

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/watch?v=vSjTzhoJFdk&lc=UgzTC8V4jCzDHbmfCHF4AaABAg.9zaUSUoUUYs9zciSZa95 9d
    https://www.youtube.com/watch?v=vSjTzhoJFdk&lc=UgzTC8V4jCzDHbmfCHF4AaABAg.9zaUSUoUUYs9zckCo1tv PO
    https://www.youtube.com/watch?v=vSjTzhoJFdk&lc=UgwMsgdKKlhr2YPpxXl4AaABAg
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgwTUdEgR4bdt6crKXF4AaABAg.9xmkXGSciKJ9xonTti2s Ix
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgwWw16qBFX39JCRRm54AaABAg.9xnskBhPnmb9xoq3mGxu _b
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgzgWvzV-kvC4TJ8O414AaABAg.9xnFzCj8HRM9xon1p2ImxO
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgybZfNJd3l4FokX3cV4AaABAg.9xm_ufqOILb9xooIlv5P LY
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgzgWvzV-kvC4TJ8O414AaABAg.9xnFzCj8HRM9y38bzbSqaG
    https://www.youtube.com/watch?v=XQAIYCT4f8Q&lc=UgyWm8nL7syjhiHtpBF4AaABAg.9xmt8i0IsEr9y3FT9Y9F eM
    https://www.youtube.com/watch?v=bRd4mJglWiM&lc=UgxRmh2gFhpmHNnPemR4AaABAg.A0opm95t2XEA0q3Kshmu uY
    https://www.youtube.com/watch?v=bRd4mJglWiM&lc=UgxRmh2gFhpmHNnPemR4AaABAg
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.eileenslounge.com/viewtopic.php?f=21&t=40701&p=314836#p314836
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314621#p314621
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314619#p314619
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314600#p314600
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314599#p314599
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314274#p314274
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314229#p314229
    https://www.eileenslounge.com/viewtopic.php?f=27&t=40621&p=314195#p314195
    https://www.eileenslounge.com/viewtopic.php?f=36&t=39706&p=314110#p314110
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 03-19-2024 at 01:23 PM.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 184
    Last Post: 03-16-2024, 01:16 PM
  2. Vlookup help needed
    By AbuReem in forum Excel Help
    Replies: 15
    Last Post: 11-12-2013, 11:32 AM
  3. TESTING Column Letter test Sort Last Row
    By alansidman in forum Test Area
    Replies: 0
    Last Post: 10-24-2013, 07:14 PM
  4. formulas needed please
    By paul_pearson in forum Excel Help
    Replies: 5
    Last Post: 03-21-2013, 04:43 PM
  5. Feed / Post Data on Web Page Using VBA
    By in.vaibhav in forum Excel Help
    Replies: 10
    Last Post: 01-10-2013, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •