View Single Post
 
Old 11-17-2015, 08:35 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: Oct 2015
Posts: 87
Officer_Bierschnitt is on a distinguished road
Default Converting a date to a String AND concatenating to a "real" text

Hi,

I have to construct the name of a worksheet that I want to open - I guess I can access the sheet using the index_number, but I want to make sure in case someone should have the idea of inserting some new sheet. You never know ...
Up to now I have this code in my VBA script.
It all works fine but for the last line which is seemingly not executed - nor does the script throw an error, it just skips that or whatever.

Code:
Dim v_date As Date
Dim v_datestr As String
Dim v_datestr2 As String
Dim v_Sheetname_pre As String
Dim v_Sheetname As String


    Range("A1802").Select
    Selection.NumberFormat = "dd/mm/yy;@"
    ActiveCell.FormulaR1C1 = "= TODAY()"
    v_date = ActiveCell
    v_datestr = CStr(ActiveCell)
    v_datestr2 = Left(v_datestr, 6) & Right(v_datestr, 2)
    Range("A1803").Select
    ActiveCell.FormulaR1C1 = "= ""Data Input """
    v_Sheetname_pre = ActiveCell
    v_Sheetname = v_Sheetname_pre & v_datestr2
Can anybody tell me what is going wrong here?

Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote