How do I concatenate cell values and text together using Excel VBA?
问题 I have a repetitive task I'd like to automate instead of using the =Concatenate function all the time. Here's my code so far: Cells(2, 5).Value = Cells(2, 1).Value&" - "&Cells(2, 2).Value Unfortunately this results in the "Compile error: Expected: end of statement" error, which highlights the " - ". How can I sandwich that text, " - ", between those two values? 回答1: Cells(2, 5).Value = Cells(2, 1).Value & " - " & Cells(2, 2).Value 回答2: @Joshua provided an answer for you situation. Another