SHARE
TWEET

Memilih Cell Terakhir Yang Di Tulisi di Excel

stevennathaniel Feb 2nd, 2016 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports Excel = Microsoft.Office.Interop.Excel
  2.  
  3. Imports Microsoft.Office
  4.  
  5.  
  6.  
  7. Public Class Form14
  8.  
  9.     Dim appXL As Excel.Application = Nothing
  10.  
  11.     Dim wbXL As Excel.Workbook = Nothing
  12.  
  13.     Dim shXL As Excel.Worksheet = Nothing
  14.  
  15.     Dim raXL As Excel.Range = Nothing
  16.  
  17.  
  18.  
  19.  
  20.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  21.  
  22.         appXL = New Excel.Application
  23.  
  24.         wbXL = appXL.Workbooks.Open("D:\fileExcel\Latihan100.xlsx")
  25.  
  26.         appXL.Visible = True
  27.  
  28.         'Memilih sheet yg bernama: Kertas Baru
  29.         shXL = wbXL.Sheets("Kertas Baru")
  30.  
  31.         'Setelah dipilih kemudian di aktifkan
  32.         shXL.Activate()
  33.  
  34.  
  35.         ' kemudian memilih cell terakhir yg berisi tulisan di worksheet Kertas Baru
  36.         shXL.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Activate()
  37.  
  38.         appXL.UserControl = True
  39.  
  40.         raXL = Nothing
  41.  
  42.         wbXL = Nothing
  43.  
  44.         shXL = Nothing
  45.  
  46.         appXL = Nothing
  47.  
  48.  
  49.         Exit Sub
  50.  
  51. Err_Handler:
  52.  
  53.         MsgBox(Err.Description, vbCritical, "Error " & Err.Number)
  54.  
  55.  
  56.     End Sub
  57. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top