Select lines by their number
Solved
simco
-
simco Posted messages 53 Status Member -
simco Posted messages 53 Status Member -
Hello everyone,
I would like to know how it is possible to select multiple non-consecutive rows by their number. Let's imagine I want to select rows 2, 6, 8, and 11 without having to click on their number on the left.
To be clearer, I need to select a series of rows across different Excel sheets, but given the number of rows to select, it would be very laborious to select them one by one while holding down Ctrl.
I hope I have been clear, and I look forward to your responses.
Thank you in advance
Configuration: Windows / Firefox 49.0
I would like to know how it is possible to select multiple non-consecutive rows by their number. Let's imagine I want to select rows 2, 6, 8, and 11 without having to click on their number on the left.
To be clearer, I need to select a series of rows across different Excel sheets, but given the number of rows to select, it would be very laborious to select them one by one while holding down Ctrl.
I hope I have been clear, and I look forward to your responses.
Thank you in advance
Configuration: Windows / Firefox 49.0
3 answers
-
Hello
We will need to go through a small macro
http://www.cjoint.com/c/FKgtLaTssvn
Best regards -
Vous avez bien séparé les numéros de lignes par un espace ?
-
Yes. While searching, I managed to find something decent.
On VBA, I went to my sheet and then right-clicked to copy and paste your original code, then I executed it on my sheet from VBA.
I get an error message saying:
Runtime Error '13' Type mismatch.
But when I return to my Excel sheet, the desired rows are selected. I don't know why I'm getting this error message. So basically, I think I can do it this way. It won't be as quick as just Ctrl + K, but it's better than nothing :)
Maybe it's because my Excel workbook is saved as .xlxs?
-
-
You need to save it in xlsm format
A version to clean the listPublic Sub OK()
Cdlmnt
Dim s, ts, k, plage As Range
s = Selection.Value
s = Trim(s)
While InStr(1, s, " ")
s = Replace(s, " ", " ")
Wend
ts = Split(s, " ")
Set plage = Rows(ts(0))
For k = 1 To UBound(ts)
Set plage = Union(plage, Rows(ts(k)))
Next k
plage.Select
End Sub