向VBA中的当前模块添加更多if语句

时间:2019-06-03 21:37:00

标签: excel vba

我已经有工作代码,但仅适用于一个人。我需要能够将许多人的数据从一张纸移到另一张纸

Sub button()

With Worksheets("three").Range("G1")

    If .Value = "sconlon@iadvancenow.com" Then

     Worksheets("Sheet2").Range("C3") = .Offset(0, 1).Value

     Worksheets("Sheet2").Range("D3") = .Offset(0, 2).Value

     End If

With Worksheets("three").Range("G1")

    If .Value = "kedwards@iadvancenow.com" Then

    Worksheets("Sheet2").Range("C4") = .Offset(0, 1).Value

    Worksheets("Sheet2").Range("D4") = .Offset(0, 2).Value

    End If

End With 

End Sub

我只从第一个人那里得到结果

1 个答案:

答案 0 :(得分:1)

您当前的代码应无法使用<template> <div> <div class="cards" v-for="(noticia, index) in listado_noticias" :key="index"> <a @click="leerNota(noticia)" class="card" style="background-image: url('https://source.unsplash.com/E7q00J_8N7A');"> <f7-card-content :padding="true"> <p>{{noticia.titulo}}</p> <span class="badge color-yellow text-color-black">{{noticia.resumen}}</span> </f7-card-content> </a> </div> <f7-card expandable> <f7-card-content :padding="false"> <div class="bg-color-yellow" :style="{height: '300px'}"> <f7-card-header text-color="black" class="display-block"> Framework7 <br/> <small :style="{opacity: 0.7}">Build Mobile Apps</small> </f7-card-header> <f7-link card-close color="black" class="card-opened-fade-in" :style="{position: 'absolute', right: '15px', top: '15px'}" icon-f7="close_round_fill"></f7-link> </div> <div class="card-content-padding"> <p>Framework7 - is a free and open source HTML mobile framework to develop hybrid mobile apps or web apps with iOS or Android (Material) native look and feel...</p> </div> </f7-card-content> </f7-card> <f7-card content="This is a simple card with plain text, but cards can also contain their own header, footer, list view, image, or any other element." ></f7-card> </div> </template> 进行编译。您只需要1条Compile error: Expected End With语句即可完成操作。此外,在这种情况下,请使用With

If/ElseIf

但是,我不确定您要完成什么-现在您仅查看单元格Sub button() With Worksheets("three").Range("G1") If .Value = "sconlon@iadvancenow.com" Then Worksheets("Sheet2").Range("C3") = .Offset(0, 1).Value Worksheets("Sheet2").Range("D3") = .Offset(0, 2).Value ElseIf .Value = "kedwards@iadvancenow.com" Then Worksheets("Sheet2").Range("C4") = .Offset(0, 1).Value Worksheets("Sheet2").Range("D4") = .Offset(0, 2).Value Else 'Add whatever else you need - or maybe some more ElseIfs! End If End With End Sub -数据设置如何?您必须提供更多详细信息,以帮助我们。