阅读背景:

我需要通过在vba中指定列号来选择Excel中的列

来源:互联网 
Dim count As Integer
Dim myData As Workbook
Dim col As Integer, rng As Range, n#, b#

col = Selection.Column 'choose the column to count the values from

If Application.WorksheetFunction.CountA(Columns(col)) = 0 Then
  MsgBox "You have selected a blank column"
  n = 0
Else
  Set rng = Intersect(Columns(col), ActiveSheet.UsedRange)
  On Error Resume Next
  b = rng.Cells.SpecialCells(xlCellTypeBlanks).count
  n = rng.Cells.count - b - 1
  On Error GoTo 0
  Worksheets("sheet1").Select
Dim count As Integer
Dim myData As Workbook
Dim



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: