• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Separate letters in columns

Visor

Member
Dear friends, what can I miss to get every 4 cells to skip a cell and continue separating the letters of the contents of a cell?
so that it is the same as shown in row 10 from cell 4
I upload the file so you can see it
I appreciate your support in advance
 

Attachments

  • Separar_conSaltos_V1.xlsm
    20.1 KB · Views: 15
Can you explain why the green cells have the values they have
what is their source?
 
Thanks for answering, I really just want the letters to be located separating every 4, that is, in the fifth position there will be an empty cell in the direction of the cell with yellow filling.

upload_2018-4-7_15-22-24.png

It is a test result sheet for students.
Now to exploit the green colors, it really is: number of questions 1, 2,3 ... 10
abcd are answer options
the green colors represent the correct ones. Somehow I enter the results as shown in cell BA, Then what I do is separate to evaluate
 

Attachments

  • upload_2018-4-7_15-21-33.png
    upload_2018-4-7_15-21-33.png
    2 KB · Views: 8
Hi,
Here's a suggestion for you :

Code:
Sub Separar2()
  Dim g As Long
  Dim y As Integer, k As Integer
  Dim código As String
  Dim respuesta(1 To 100)

  g = Hoja1.Range("B" & Rows.Count).End(xlUp).Row
  Range("D" & g & ":" & "AZ" & g).Interior.Color = xlNone
 
  'Separar los numeros en cada celda
  código = Hoja1.Range("BA" & g - 1)
  k = 2
  For y = 1 To Len(código)
      If y Mod 4 = 0 Then
        respuesta(k) = Mid(código, y, 1)
        k = k + 2
      Else
        respuesta(k) = Mid(código, y, 1)
        k = k + 1
      End If
  Next y

  Hoja1.Range("C" & g & ":" & "AZ" & g) = respuesta
End Sub
 
Select C10:AZ11 etc
Goto Home, Conditional Formatting
New Rule, Use a Formula
=AND(C10>0,ISNUMBER(C10))
then apply a Format, Custom Number Format ;;;

enjoy
 
If my previous answer misread the question and you actually wanted to distribute cell BA10 to the cells to the left
in C10: =IF(LEFT(C7,1)="P",RIGHT(C7,LEN(C7)-1),MID($BA$10,COLUMN()-2-SUMPRODUCT(--(LEFT($C$7:C7,1)="P")),1))
copy that across to AZ10
 
Thanks GCExcel, it works very well, just as I wanted, however I thought that the code that I put

Code:
sub separar()
g = Hoja1.Range("B" & Rows.Count).End(xlUp).Row
'Separar los numeros en cada celda
  código = Hoja1.Range("BA" & g - 1)
  For y = 1 To Len(código)
        Hoja1.Cells(g, y + 3) = Mid(código, y, 1)
  Next y
end sub

Only required a variable counter of jump, or something less, .. but I see that it is more complex
Thank you Hui for your support, I actually need to use vba code for this time
 
Back
Top