-
Fototrend
A Microsoft Excel topic célja segítséget kérni és nyújtani Excellel kapcsolatos problémákra.
Kérdés felvetése előtt olvasd el, ha még nem tetted.
Új hozzászólás Aktív témák
-
Kraptor
őstag
válasz
hbbalint
#101
üzenetére
Úgy simán sehogy, mert 65K a limit, de vannak okosságok amivel meglehet kerülni ezeket. Van egy progi amit Microsoft Office Spreadsheet 10.0 UserForm control-nak hívnak és ezzel elvileg létretudsz hozni 18,278 x 262,144-es lapokat.Ezt nem tudom, hogy mennyire igaz vagy nem.
Vagy vannak különböző makrók amikkel megtudsz nyitnyi nagyobb fileokat, csak akkor több lapba fogja megnyitni őket automatikusan.
Sub ImportLargeFile()
'Imports text file into Excel workbook using ADO.
'If the number of records exceeds 65536 then it splits it over more than one sheet.
Dim strFilePath As String, strFilename As String, strFullPath As String
Dim lngCounter As Long
Dim oConn As Object, oRS As Object, oFSObj As Object
'Get a text file name
strFullPath = Application.GetOpenFilename(''Text Files (*.txt),*.txt'', , ''Please select text file...'')
If strFullPath = ''False'' Then Exit Sub 'User pressed Cancel on the open file dialog
Application.ScreenUpdating = False
'This gives us a full path name e.g. C:\folder\file.txt
'We need to split this into path and file name
Set oFSObj = CreateObject(''SCRIPTING.FILESYSTEMOBJECT'')
strFilePath = oFSObj.GetFile(strFullPath).ParentFolder.Path
strFilename = oFSObj.GetFile(strFullPath).Name
'Open an ADO connection to the folder specified
Set oConn = CreateObject(''ADODB.CONNECTION'')
oConn.Open ''Provider=Microsoft.Jet.OLEDB.4.0;'' & _
''Data Source='' & strFilePath & '';'' & _
''Extended Properties=''''text;HDR=Yes;FMT=Delimited''''''
Set oRS = CreateObject(''ADODB.RECORDSET'')
'Now actually open the text file and import into Excel
oRS.Open ''SELECT * FROM '' & strFilename, oConn, 3, 1, 1
While Not oRS.EOF
Sheets.Add
ActiveSheet.Range(''A1'').CopyFromRecordset oRS, 65536
Wend
oRS.Close
oConn.Close
Application.ScreenUpdating = True
End Sub
Itt egy másik is:
Sub LoadData()
Const cCol1 = 20, cCol2 = 20, cCol3 = 20, cLimit = 50000
Dim intFreeFile As Integer, i As Long, j As Long, strTemp As String
Dim arr() As String
On Error Resume Next
intFreeFile = FreeFile
Open ''c:\test.txt'' For Input As #intFreeFile
i = 0: j = 1
ReDim arr(cLimit, 2)
Do Until EOF(intFreeFile)
Line Input #intFreeFile, strTemp
arr(i, 0) = Trim(Mid(strTemp, 1, cCol1))
arr(i, 1) = Trim(Mid(strTemp, cCol1, cCol2))
arr(i, 2) = Trim(Mid(strTemp, cCol1 + cCol2, cCol3))
i = i + 1
If i > cLimit - 1 Then
Cells(1, j).Resize(cLimit, 3).Value = arr
i = 0: j = j + 3
ReDim arr(cLimit, 2)
End If
Loop
Close #intFreeFile
End Sub
Új hozzászólás Aktív témák
- Windows 10/11 Home/Pro , Office 2024 kulcsok
- Kaspersky, BitDefender, Avast és egyéb vírusírtó licencek a legolcsóbban, egyenesen a gyártóktól!
- Bitdefender Total Security 3év/3eszköz! - Tökéletes védelem.
- MS SQL Server 2016, 2017, 2019
- Eredeti Microsoft termékek - MEGA Akciók! Windows, Office Pro Plus, Project Pro, Visio Pro stb.
- í kilenc! AKCIÓS PRECÍZIÓS KÉSZÜLÉK! 7560 i9-11950H 32GB RAM 1TB SSD Nvidia RTX A3000 6GB 1 év gar
- 27% - Samsung S27D360GAU VA Monitor! 100Hz / 1920x1080 / 4ms
- Sata 240GB SSD // 100/100% // számla // garancia
- Xiaomi Mi Note 10 Lite 128GB, Kártyafüggetlen, 1 Év Garanciával
- BESZÁMÍTÁS! ASRock B550 R5 5600 16GB DDR4 512GB SSD RX 6600 XT 8GB Zalman i3 Edge FSP 700W
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Fferi50