excel-vba

VBA Borders Excel Dependent on Page Size

廉价感情. 提交于 2020-01-04 19:17:08
问题 I want to create borders around each of my excel pages dependent on the size of the page e.g. number of rows and columns can vary all the time. I've tried this but it's specific cells Sub AddBorders() With Range("B8:I10") .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous End With End Sub 回答1: UsedRange should NEVER be used to find the last cell which has data

Declaring a dictionary in VBA

北城余情 提交于 2020-01-04 19:10:27
问题 I'm getting an error Run-time error '424': Object required when I try to create a dictionary in VBA. My code is shown below: Private Sub data() Dim dicti As Object Set dicti = CreateObject(Scripting.Dictionary) How can I fix this issue? 回答1: Try, dim dicti As Object Set dicti = CreateObject("Scripting.Dictionary") Alternately, swap the late binding for early binding by accessing the VBE's Tools, References and including Microsoft Scripting Runtime with a check. dim dicti as new Scripting

Invalid or Unqualified Reference

假装没事ソ 提交于 2020-01-04 16:58:36
问题 Do I need to put in the sheet name? I need to use this macro across multiple workbooks with similar worksheets but the tab names are different. Sub pageSetup() ActiveSheet.pageSetup .Orientation = xlLandscape .PaperSize = xlPaperLegal .FitToPagesWide = 1 .FitToPagesTall = 1 .LeftMargin = Application.InchesToPoints(1#) End Sub 回答1: As Tim has not claimed his answer, you could use either of the following two options to either format the ActiveSheet format all WorkSheets in the ActiveWorkBook

Free tutorial websites for VBA version 7 for Office Excel 2007 [closed]

大憨熊 提交于 2020-01-04 16:58:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . What are the FREE websites for VBA version 7 for Office 2007? Google lets us down with a lot of payed spam with "the best of the best of the best" tutorials EVER. I have the experience with programming from C#, .NET, Object Pascal, PHP,.. It will not be for a beginner, rather the intermediate in the field.

Sort without moving formatting

若如初见. 提交于 2020-01-04 15:28:34
问题 I have an Excel table in which multiple rows are given different coloured backgrounds by VBA macros. These background colours should be locked to the rows. My problem is that when the table is sorted by one column or another the background colours move as the data is reordered. Can I format in another way to stop this happening so that the cells remain locked? The code I use to format is: For Each Row In rng.Rows If Condition Then Row.Select cIndex = ColourIndex(colour) With Selection

VBA Excel Changing Italics and adding </ and /> [closed]

情到浓时终转凉″ 提交于 2020-01-04 15:11:34
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I wonder if someone has ever come across with something like that. I have a list in an Excel column which has italics inserted in the text. Something like: First row: The distribution of Calidris pugnax has been reduced Second row: Hydrotaea glabricula is no longer a threatened

VBA Excel Changing Italics and adding </ and /> [closed]

拟墨画扇 提交于 2020-01-04 15:11:09
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I wonder if someone has ever come across with something like that. I have a list in an Excel column which has italics inserted in the text. Something like: First row: The distribution of Calidris pugnax has been reduced Second row: Hydrotaea glabricula is no longer a threatened

Using Excel for address, string manipulation

余生颓废 提交于 2020-01-04 14:21:07
问题 I'm currently doing some work with a very large data source on city addresses where the data looks something like this. source: NO. 174 5/F 174 SMITH STREET 174 SMITH STREET TOR i've used a function which removes the duplicates shown on extendoffice. https://www.extendoffice.com/documents/excel/2133-excel-remove-duplicate-characters-in-string.html Function RemoveDupes2(txt As String, Optional delim As String = " ") As String Dim x With CreateObject("Scripting.Dictionary") .CompareMode =

Using Excel for address, string manipulation

情到浓时终转凉″ 提交于 2020-01-04 14:20:08
问题 I'm currently doing some work with a very large data source on city addresses where the data looks something like this. source: NO. 174 5/F 174 SMITH STREET 174 SMITH STREET TOR i've used a function which removes the duplicates shown on extendoffice. https://www.extendoffice.com/documents/excel/2133-excel-remove-duplicate-characters-in-string.html Function RemoveDupes2(txt As String, Optional delim As String = " ") As String Dim x With CreateObject("Scripting.Dictionary") .CompareMode =

Using Excel for address, string manipulation

北城余情 提交于 2020-01-04 14:20:08
问题 I'm currently doing some work with a very large data source on city addresses where the data looks something like this. source: NO. 174 5/F 174 SMITH STREET 174 SMITH STREET TOR i've used a function which removes the duplicates shown on extendoffice. https://www.extendoffice.com/documents/excel/2133-excel-remove-duplicate-characters-in-string.html Function RemoveDupes2(txt As String, Optional delim As String = " ") As String Dim x With CreateObject("Scripting.Dictionary") .CompareMode =