多页覆盖更新

时间:2014-06-16 03:37:42

标签: excel vba

我试图从一个页面中提取多个值,如果按下该按钮,则使这些值覆盖其他页面上的值。

Private Sub CommandButton1_Click()

Dim MemberP As String, RangeUserP As String, BuyerP As String
Dim CCP As String, SMP As String, FMP As String
Dim MemberGP As String, GunNumb As String

Worksheets("TreeMap").Select
MemberP = Range("Z16")
RangeUserP = Range("R28")
BuyerP = Range("I28")
CCP = Range("Z24")
FMP = Range("AA24")
SMP = Range("AB24")
MemberGP = Range("R41")
GunNumb = Range("G43")

//Part 1

Worksheets("Membership Model").Select
Range("R11").Value = MemberP
Range("C10") = CCP
Range("H10") = FMP
Range("L10") = SMP
Worksheets("S1- Buyers RangeUsers").Select
Range("B6") = RangeUserP
Range("B7") = BuyerP
Worksheets("S2- Range Users Splits").Select
Range("J11") = MemberGP
Worksheets("S4- Selling Points").Select
Range("K6") = GunNumb
MsgBox ("Updated")

//Part 2

End Sub

MsgBox有效。

第1部分是输入位置,第2部分是输出位置。

1 个答案:

答案 0 :(得分:0)

这有效...不知何故。

Private Sub CommandButton1_Click()

Dim MemberP As String,RangeUserP As String,BuyerP As String,CCP As String,SMP As String,FMP As String,MemberGP As String,GunNumb As String

Worksheets("TreeMap").Select
MemberP = Range("Z16")
RangeUserP = Range("R28")
BuyerP = Range("I28")
CCP = Range("Z24")
FMP = Range("AA24")
SMP = Range("AB24")
MemberGP = Range("R41")
GunNumb = Range("G43")

Worksheets("Membership Model").Range("R11").Value = MemberP
Worksheets("Membership Model").Range("C10").Value = CCP
Worksheets("Membership Model").Range("H10").Value = FMP
Worksheets("Membership Model").Range("L10").Value = SMP

Worksheets("S1- Buyers RangeUsers").Range("B6").Value = RangeUserP
Worksheets("S1- Buyers RangeUsers").Range("B7").Value = BuyerP

Worksheets("S2- Range Users Splits").Range("J11").Value = MemberGP

Worksheets("S4- Selling Points").Range("K6").Value = GunNumb

MsgBox ("Updated")

End Sub