Cells(1, 3) = Left(Cells(1, 1), Application.Find(",", Cells(1, 1), 1) - 1)
[c1] = Left([a1], Application.Find(",", [a1], 1) - 1)
用VBA的话在ThisWorkBook内输入
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Cells(1, 3) = Cells(1, 2)
End Sub
但只要在单元格C1中输入 =B1 不就行么了……效果差不多的了……
不是很明白LZ想表达的意思……
1、Find 的用法如下:
Set look = Sheets(1).Range("B1:B100").Find(What:="123456", LookIn:=xlValues, LookAt:=xlWhole) '找B1到B100间有'123456'数字的储存格
Cells(1, 3) = Sheets(1).Cells(look.Row, 2) 'Cells(1,3) 值 = look储存格所在列的B栏值
2、您要复制B1到C1 可用如下方法
Range("B1").Select
Selection.Copy
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
3、其实只要cells(1,3) = cells(1,2)即可