velohead
Board Regular
- Joined
- Aug 22, 2007
- Messages
- 212
Hi All,
Ultimately, I want a piece of code to insert the following excel formula into cell AX2.
="WE-"&YEAR(E2)&"-"&TEXT(E2,"MM")&"-"&TEXT(E2,"DD")
my code at the moment is...
the result in excel is ="WE-"&YEAR(E2)
As you can see, the VB code contains more " characters than the result.
This is correct, as I in VB one needs to 'wrap' the 'text bit' in " characters.
I'm struggling to build this up though.
Getting bambozzled with how many " to make it work![Frown :( :(](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Ultimately, I want a piece of code to insert the following excel formula into cell AX2.
="WE-"&YEAR(E2)&"-"&TEXT(E2,"MM")&"-"&TEXT(E2,"DD")
my code at the moment is...
VBA Code:
Sub D207_AX2_Only()
Range("AX2").Select
ActiveCell.Formula = "=""WE-""&YEAR(E2)"
End Sub
the result in excel is ="WE-"&YEAR(E2)
As you can see, the VB code contains more " characters than the result.
This is correct, as I in VB one needs to 'wrap' the 'text bit' in " characters.
I'm struggling to build this up though.
Getting bambozzled with how many " to make it work