首页->【软件工具包使用(Software Tools Usage)】

2 1


Rem subname auto_fill.bas
Rem  subfunction auto fill the value of eqn,
'tset,spec,tn,port and pid
'release date 8/7/18
Option Explicit

Public Function autoFill()

Application.ScreenUpdating = False

Dim eqn As Integer
Dim tset As Integer
Dim spec As String
Dim tn  As String
Dim pn  As String
Dim pid  As Integer

'for saving the execute time
Set patcsv = Sheet1

tn = "t123" 'col a
pid = 0 'col b
pn = "LED0" 'col c
eqn = 2 'col d
spec = "LED0_DRV_LOW_noLoad" 'col e
tset = 1 'col f


'auto fill the value of A1:A256 for tn
patcsv.Range("A1:A256").Select
patcsv.Range("A1:A256").Value = tn

''auto fill the value of B1:B256 for pid
patcsv.Range("B1:B256").Select
For k = 1 To 256
       Cells(k, 2).Value = pid + k
Next k

''auto fill the value of C1:C256 for pn
patcsv.Range("C1:C256").Select
patcsv.Range("C1:C256").Value = pn

''auto fill the value of D1:D256 for eqn
patcsv.Range("D1:D256").Select
patcsv.Range("D1:D256").Value = eqn

''auto fill the value of E1:E256 for spec
patcsv.Range("E1:E256").Select
patcsv.Range("E1:E256").Value = spec

''auto fill the value of F1:F256 for tset
patcsv.Range("F1:F256").Select
patcsv.Range("F1:F256").Value = tset

Application.ScreenUpdating = True 'saving time


End Function



楼主可见

  1. shwnyoo 1#

    vba excel 代码基础实力,提高程序自动化,降低工作量