Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-17-2015, 08:35 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Converting a date to a String AND concatenating to a "real" text Windows 7 64bit Converting a date to a String AND concatenating to a "real" text Office 2013
Advanced Beginner
Converting a date to a String AND concatenating to a "real" text
 
Join Date: Oct 2015
Posts: 79
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
  #2  
Old 11-17-2015, 09:11 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Converting a date to a String AND concatenating to a "real" text Windows 7 64bit Converting a date to a String AND concatenating to a "real" text Office 2013
Advanced Beginner
Converting a date to a String AND concatenating to a "real" text
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

Okay,

I have figured out that one, so that's solved.
Reply With Quote
  #3  
Old 12-01-2015, 06:18 PM
Graham Griggs Graham Griggs is offline Converting a date to a String AND concatenating to a "real" text Windows 8 Converting a date to a String AND concatenating to a "real" text Office 2013
Novice
 
Join Date: Dec 2015
Posts: 11
Graham Griggs is on a distinguished road
Default file save problem

In general you are trying to do things in VBA that are a bit tricky and difficult to test

Do things like formulae and formatting in Excel - that is what it is good at

once you do that the solution is simple - see attached
Attached Files
File Type: xlsm My File Name - 02 Dec 15.xlsm (15.1 KB, 1 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a date to a String AND concatenating to a "real" text How do I get auto-updated "number of days since specified date" on MS word? terry795 Word 16 01-07-2016 04:33 PM
Converting a date to a String AND concatenating to a "real" text Fixing/stabilizing/setting/securing/converting markup of tracked changes into "hard" formatting paulkaye Word 6 08-20-2015 02:36 AM
Converting a date to a String AND concatenating to a "real" text When Outlook starts, a warning box "String was not recognized as a valide datetime" twormington Outlook 4 02-03-2014 11:01 PM
Converting a date to a String AND concatenating to a "real" text Macro VBA "Save as" with bookmarks in file name string Dom37 Word VBA 2 10-31-2011 03:28 AM
Converting a date to a String AND concatenating to a "real" text How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM


All times are GMT -7. The time now is 03:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft