Forum Discussion

sophiekatchu's avatar
sophiekatchu
Copper Contributor
Apr 01, 2022
Solved

is there a fast way to match my "cell content" to the "row number"

Hello guys,
please help me 😞

is there a fast way to match my "cell content" to the "row number"? TT_TT

Ex: the ones with the yellow Highlight

my "cell content" 326 matches with the "row number" 326
my cell content 337, matches with the row number 337

 

I want to do the same thing with cell contents 350, 353, 361, 365, 372, 380, 385, 389, 397, 402, 409 and 411

 

PLEASE HELP ME πŸ’”

 

  • sophiekatchu 

    In the attached file you can click the button in cell H2 to start the macro. Maybe this is what you are looking for.

     

    Sub rownumber()
    
    Dim i As Integer
    Dim z As Integer
    
    For i = 1 To 1000
    
    If Cells(i, 1).Value > 0 Then
    
    z = Cells(i, 1).Value
    
    Cells(z, 5).Value = Cells(i, 1).Value
    Cells(z, 6).Value = Cells(i, 2).Value
    
    Else
    End If
    
    Next i
    
    End Sub

9 Replies

  • sophiekatchu 

    In the attached file you can click the button in cell H2 to start the macro. Maybe this is what you are looking for.

     

    Sub rownumber()
    
    Dim i As Integer
    Dim z As Integer
    
    For i = 1 To 1000
    
    If Cells(i, 1).Value > 0 Then
    
    z = Cells(i, 1).Value
    
    Cells(z, 5).Value = Cells(i, 1).Value
    Cells(z, 6).Value = Cells(i, 2).Value
    
    Else
    End If
    
    Next i
    
    End Sub
  • pfridolf's avatar
    pfridolf
    Copper Contributor

    sophiekatchu 

    If you can accept an extra column (that could be hidden) this might be a simple solution. 

    The information in column E will be reflected to column B in the row number put in column D.

    Of course the IF(ISTEXT ...;"") could be skipped. (unfortunately I can't attach files)

     

     

    • sophiekatchu's avatar
      sophiekatchu
      Copper Contributor
      it doesn't work, but thank you so much Riny 😞

      what I want is to sort it easily where the cell number matches with the corresponding row number

      so if my cell contains the number 15, I want it to be in row number 15

      What I do is I do it "manually", I highlight then insert cells down until it reaches the corresponding row number ~it's tiresome and it's eating up my time too much πŸ’”
      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        sophiekatchu As a variant, I came up (after some thought) with a PowerQuery solution. Assuming that your columns will have headers and that there may be an unknown number of columns in the Table.

         

        File attached.

        Edit: Made a small change to the query.

         

Resources