excel-2010

Change chart font using VBA

孤者浪人 提交于 2020-08-07 06:11:29
问题 How do I change the font of an Excel chart using VBA? If I manually select the chart, and record a macro while I manually change the font name and size, I get the macro below. But when I immediately replay the macro, it throws a run-time error: "The specified value is out of range." So it looks like the macro recorder has a bug. Which means I can't figure out the code to change the font myself. Sub Macro6() ' ' Macro6 Macro ' ' With ActiveSheet.Shapes("Chart 1").TextFrame2.TextRange.Font

excel date formatting not working

拟墨画扇 提交于 2020-07-18 10:18:43
问题 I have an excel sheet created by a 3rd party program. One of the columns has dates in this format: "Jan 19, 2015 03:00:00 PM" I would like these dates to appear in the following format: "19/01/2015" I have selected the cell or cells, right clicked and selected "Format Cells...", chose "Date" in the category, then chose "14/03/2001" in the type, to no avail, the dates won't change. I also tried "Custom" from the category and "dd/mm/yyyy" from the type, again, no changes at all. The file is not

Expression to test for one or more spaces in VBA to find matches in Excel cells

自闭症网瘾萝莉.ら 提交于 2020-07-09 02:44:49
问题 I am trying to use regular expressions in a macro for an Excel document. Here is what I have so far: dim regex regex.pattern = "\s+" for p = 3 to totalparamcount if (regex.test(Worksheets("table").Cells(p,1)) then msgbox ("blah blah") end if next The pattern I am trying to match is one or more spaces, tabs, newlines, which I saw is denoted by "\s" . The line ' if (regex.test(Worksheets("table").Cells(p,1)) then ' is getting this error: Run-time error '424': Object required I am using VBA 7.0