使用for循环创建另一个工作表,以将不需要的数据过滤到另一个工作表中

时间:2019-11-30 16:45:23

标签: excel vba

基本上,我希望我的代码进行验证以从数据表中获取特定数据。 check列是用于过滤出数据的列,该数据仅用于将我想要的数据生成到传输表中。我正在尝试通过选择与另一个工作表匹配的值来使用VBA生成另一个Excel工作表。

当前它在for循环结束,我不知道如何继续产生所需的值。请帮我,因为我是VBA的新手。如果您有任何要问的问题,请不要犹豫,因为这是一项重要的工作。

我想知道如何创建一个过滤器,其中的正则表达式仅匹配前3个值(例如t04),而其余匹配为随机字符串值

Public Function DoesSheetExist(SheetName As String, BookName As Workbook) 
      As Boolean

Dim obj As Object
On Error Resume Next
'only if there is an error, sheet doesnt exist

Set obj = BookName.Worksheets(SheetName)
If Err = 0 Then
    DoesSheetExist = True
Else
    DoesSheetExist = False
End If

On Error GoTo 0

End Function
<!-- Toolbar -->
<div class="toolbar" role="banner">
  <img width="70" src="\assets\images\logo.png" />
  <span>FitnessWorkout</span>
    <div class="spacer"></div>
    <span nav-tool-items>
        <button menu-item color="accent" routerLink="/signup">Sign-up</button>
        <button menu-item color="primary" routerLink="/login">Login</button>
        <button menu-item color="warn" (click)="logout()">Log out</button>
      </span>
</div>

<!-- <mat-sidenav-container>
    <mat-sidenav #sidenav>
      <mat-nav-list>
        <a mat-list-item routerLinkActive="active" [routerLink]="'/workout-overview'"> My Workouts </a>
        <a mat-list-item routerLinkActive="active" [routerLink]="'/create-workout'"> Create Workout </a>
        <a mat-list-item (click)="sidenav.toggle()" href="" mat-list-item>Close</a>
      </mat-nav-list>
    </mat-sidenav>

    <mat-sidenav-content>
      <div style="height: 88vh;">
        <router-outlet></router-outlet>
      </div>
    </mat-sidenav-content>

  </mat-sidenav-container> -->



<div class="content" role="main">

  <!-- Highlight Card -->
  <img  width="180"  height="100"  src="\assets\images\logo.png"/>
  <p>Welcome to {{title}}</p>

  <!-- Workouts -->
  <h2>Workouts</h2>
  <div class="card-container">
    <a class="card" >
    <a mat-list-item routerLinkActive="active" [routerLink]="'/workout-overview'"> My Workouts </a> <br>
    <svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>    </a>
  </div>

  <!-- Next Steps -->
  <h2>Next Steps</h2>
  <p>What do you want to do next with your workout exercises?</p>

  <input type="hidden" #selection>

  <div class="card-container">
    <div class="card card-small" (click)="selection.value = 'component'" tabindex="0">
        <svg class="material-icons" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
        <a mat-list-item routerLinkActive="active" [routerLink]="'/create-workout'"> New Workout </a>
    </div>
  </div>

</div>

0 个答案:

没有答案