I am making a macro which imports data from pdf to excel. From everything I have pasted I only need the data from a table containing 50 rows and 7 columns. Each row is imported as a string of numbers separated by space as seen below: I need to delete the rows where the first part of the string is not a number between 1 and 50 (the 50 varies but is given as an input by the user). I have tried to set up a loop as shown - but it is getting to complex for me to figure out so the below definitely will not work - it is just to show my thought process. Furthermore is there a way to cnvert the data in the lines to numbers instead of text?
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim MyString() As String
A = 1
Do While Not IsEmpty(Cells(A + DataStart - 1, 1)) 'DataStart is the row
where data starts
MyString() = Split(Cells(A + DataStart - 1, 1))
C = 1
Do Until C = 50
If MyString(0) = C Then
For B = 0 To UBound(MyString)
Cells(A, B + 1) = MyString(B)
Next B
Else
ActiveSheet.Cells(A, 1).Select
ActiveCell.EntireRow.Delete
End If
Next C
Loop
Data Example:
44 210,21 22,55 210,21 22,553 196,505 OK
45 227,59 25,28 226,02 25,612 197,529 OK
46 228,58 25,31 228,58 25,310 197,827 OK
2019.06.06. 16:37:28 M94_2019.06.06._17471_Fólia teszt_Felsőparaméter_CB.is_tens
M94_2019.06.06._17471_Fólia teszt_Felsőparaméter_CB.is_tens 3 oldal a 4-ból/ből
Max.
Load
(N)
Extension
at Max.
(mm)
Load at
break
(N)
Extension
at break
(mm)
Terhelés 20mm-nél
(N)
Note to
sample
47 213,54 24,07 200,82 24,410 192,925 OK
48 234,06 26,23 234,06 26,231 198,417 OK
49 227,20 25,32 227,20 25,322 197,384 OK
50 211,45 25,30 211,45 25,300 192,622 OK