excel-vba

Am I using the isnumeric function correctly?

六月ゝ 毕业季﹏ 提交于 2020-01-14 14:56:12
问题 This program is to convert a column of data from cumulative to non-cumulative. On my sheet I have A1, B1, and C1 with the text Non-Cumulative, Cumulative, and Converted, respectively. I have numbers 1 to 10 beneath A1, then them summed cumulatively beneath B1. C1 is where I want to convert column B back to non-cumulative. The IsNumeric is used to make the first row of data in C equal to the first row of data in B. It should detect that the title is above the number it is evaluating, thus

Am I using the isnumeric function correctly?

Deadly 提交于 2020-01-14 14:55:15
问题 This program is to convert a column of data from cumulative to non-cumulative. On my sheet I have A1, B1, and C1 with the text Non-Cumulative, Cumulative, and Converted, respectively. I have numbers 1 to 10 beneath A1, then them summed cumulatively beneath B1. C1 is where I want to convert column B back to non-cumulative. The IsNumeric is used to make the first row of data in C equal to the first row of data in B. It should detect that the title is above the number it is evaluating, thus

How to remove spaces from an entire Excel column using VBA?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-14 14:44:35
问题 I'm trying to delete the spaces that I have in each field of the column "A" this spaces are at the end of the string some of the string has 3 spaces others 4. When I run the code, I don't have error, so I think I have a bug because nothing happened when is running. Dim result As String Last = Cells(Rows.Count, "A").End(xlUp).Row For i = Last To 1 Step -1 If (Right(Cells(i, "A").Value, 4)) Like " " Or (Right(Cells(i, "A").Value, 3)) Like " " Then result = Replace(Cells(i, "A"), " ", "") End If

Copy and Paste Row and Columns(with formulas) and Paste down to the last row in VBA

久未见 提交于 2020-01-14 14:35:13
问题 Firstly, I have multiple sheets with values and formula's. I have used VBA to pull down clean data, which is working fine. For Example "Sheet1", From Row 3 to 100 and Column H to K is where I have the values. Now, I have a formula on row 3 and Column B to F that is linked to the values on Columns H to K. I am having problem copying row 3 and pasting the formulas down to the last row on the sheet. Secondly, I have 12 worksheets. They have different values and formula's from "sheet 1". But I

Excel 2013 VBA Range.RemoveDuplicates issue specifying array

拟墨画扇 提交于 2020-01-14 14:13:18
问题 The sheets that I am scanning for duplicates have different numbers of columns I'm trying to specify the array of columns for Range.RemoveDuplicates by using a string like this: Let's say there are 5 columns in this sheet Dim Rng As Range Dim i As Integer Dim lColumn As Integer Dim strColumnArray As String With ActiveSheet lColumn = Cells(1, Columns.Count).End(xlToLeft).Column strColumnArray = "1" For i = 2 To lColumn strColumnArray = strColumnArray & ", " & i Next i 'String ends up as "1, 2,

“Object doesn't support this action” for a drop down menu in Excel 2011 (Mac OS X)

本秂侑毒 提交于 2020-01-14 14:12:38
问题 I have a big Excel Workbook made with Office 2010 with some VBA code. Everything seems to work fine apart the drop down menus. Precisely, they work, graphically, but Me.Shapes("Drop Down 1").ControlFormat throws an "Object doesn't support this action" error (I am sure that "Drop Down 1" is the correct name, etc.), precisely, it gets referenced correctly (e.g. shape = Me.Shapes(1) works) but it doesn't seem to like ControlFormat . Google doesn't help much; any suggestions? I'm quite new to VBA

BeforeClose VBA Event Closing Workbook When Cancel = True

筅森魡賤 提交于 2020-01-14 12:54:12
问题 I'm trying to write a short macro that will prevent the user of an excel workbook from closing the workbook without protecting the first sheet. The code shows the message box but then proceeds to close the workbook. From my understanding, if the "Cancel" parameter is set to True, the workbook shouldn't close. Private Sub Workbook_BeforeClose(Cancel As Boolean) If Sheets(1).ProtectContents = True Then Cancel = False Else MsgBox "Please Protect 'Unique Futures' Worksheet Before Closing Workbook

Save with msoFileDialogFilePicker

风格不统一 提交于 2020-01-14 09:38:12
问题 I've already searched a lot on that subject and I've tried many things. In fact, I need to ask user to save as a custom type that is not available within the msoFileDialogSaveAs filters. I know I could save as, let's say, *.txt and then change the extension before save. I did this and it worked but when the user enter the name of the file in a folder already containing other files of the custom type, the user won't see the existing custom files list because the active filter is not of that

Excel VBA - total line to add border on top and bottom only

守給你的承諾、 提交于 2020-01-14 09:01:06
问题 I want to add a border line on top and a border line on bottom of the total line Eg. I have data from rows 2 to 3 and columns 3-4, I have then add a total line which sums line 2-3 in row 5. I want to add a border line on top and bottom of row 5 and only upto column 4. Can I use variables LastRow + 2 (note I have a blank line between the last row of data and where the total line is) and LastColumn some how in Range("A5:D5").Select as this will be varible each time? My current Code: Range("A5

Copy workbook containing macro to a workbook without macro

我只是一个虾纸丫 提交于 2020-01-14 07:33:09
问题 I am able to duplicate a workbook (copy to a desired location) which contains a macro in the background. This duplicate copy also contains the same macro. My Problem is I do not want this duplicate workbook to have a macro with it. Can anyone tell how to do it? Thank you in advance!!! 回答1: Save your workbook as macro-free, i.e. simply as Excel Workbook. For my Excel 2007 this is done using: Application.DisplayAlerts = False ThisWorkbook.CheckCompatibility = False ThisWorkbook.SaveAs Filename: