See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.
Private Sub FetchNoRowCol(ws As Excel.Worksheet, ByRef NoOfRows As Long, _ ByRef NoOfColumns As Long) ' Error-handling is here in case there is not any ' data in the worksheet. On Error Resume Next NoOfRows = ws.Cells.Find(What:="*", SearchDirection:=xlPrevious, _ SearchOrder:=xlByRows).Row NoOfColumns = ws.Cells.Find(What:="*", SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column End Sub Private Sub Command1_Click() Dim xlObject As Excel.Application Dim xlWB As Excel.Workbook Dim NoOfRows As Long Dim NoOfColumns As Long With CommonDialog1 .CancelError = True .Filter = "Microsoft Excel files (csv)" .InitDir = "C:\Documents and Settings\all users\Desktop" .ShowOpen If Not .FileName = "" Then Set xlObject = New Excel.Application Set xlWB = xlObject.Workbooks.Open(.FileName) Clipboard.Clear xlObject.Cells.Copy ' Copy all cells in active worksheet. FetchNoRowCol xlObject.ActiveWorkbook.ActiveSheet, NoOfRows, NoOfColumns With MSHFlexGrid1 .Redraw = False 'Dont draw until the end, so we avoid that flash .Rows = NoOfRows .Cols = NoOfColumns .Row = 0 'Paste from first cell .Col = 0 .RowSel = .Rows - 1 'Select maximum allowed (your selection shouldnt be greater than this) .ColSel = .Cols - 1 .Clip = Replace(Clipboard.GetText, vbNewLine, vbCr) 'Replace carriage return with the correct one .Col = 1 'Just to remove that blue selection from Flexgrid .Redraw = True 'Now draw End With xlObject.DisplayAlerts = False 'To avoid "Save woorkbook" messagebox xlWB.Close xlObject.Application.Quit Set xlWB = Nothing Set xlObject = Nothing End If End With End Sub
|A macro to Count the number of rows across all worksheets||3||63|
|Cannot Load VB6 on Windows 10. Installed OK but error on opening existing project.||7||57|
|Windows Script Host failed (Access is denied.) error||6||80|
|How to incorporate an error traping routing to existing code in VB6||11||33|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!