worksheet

Loop through all worksheets in all Excel workbooks in a folder to change the font, font size, and alignment of text in all cells

我只是一个虾纸丫 提交于 2020-01-24 01:26:13
问题 On my hard drive I have a folder containing a number of Excel workbooks. I want to loop though all the worksheets in each of the Excel workbooks in this folder to change the font, font size, and alignment of text in all the cells. From my own limited knowledge of VBA and from reading other related questions here on SO I have cobbled toghether the macro below which I have stored in Personal.xls. As it is now it seems to loop through the workbooks but it is not formating the text in any of them

Create Table in Excel Worksheet using VBA

独自空忆成欢 提交于 2020-01-22 15:15:20
问题 I have this code below that will auto select a range. Does anyone know how I can add code to create a table to the selected range? Thanks! Sub DynamicRange() 'Best used when first column has value on last row and first row has a value in the last column Dim sht As Worksheet Dim LastRow As Long Dim LastColumn As Long Dim StartCell As Range Set sht = Worksheets("Sheet1") Set StartCell = Range("D9") 'Find Last Row and Column LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row

Create Table in Excel Worksheet using VBA

流过昼夜 提交于 2020-01-22 15:15:01
问题 I have this code below that will auto select a range. Does anyone know how I can add code to create a table to the selected range? Thanks! Sub DynamicRange() 'Best used when first column has value on last row and first row has a value in the last column Dim sht As Worksheet Dim LastRow As Long Dim LastColumn As Long Dim StartCell As Range Set sht = Worksheets("Sheet1") Set StartCell = Range("D9") 'Find Last Row and Column LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row

VBA to copy worksheet from one workbook to all workbooks in another folder

可紊 提交于 2020-01-16 18:55:30
问题 Add worksheet to workbook using VBA I am looking to copy an existing (already created worksheet) into about 500 workbooks (*.xlsx) that all reside in the same folder. I was able to cobble together the below code from various other topics on here but I am not able to get it to work. Private Sub Command0_Click() Dim file As String Dim myPath As String Dim wb As Workbook Dim rng As Range Dim wbMaster As Workbook 'if master workbook already opened 'Set wbMaster = Workbooks("ProjectBabelfish.xlsx"

VBA to copy worksheet from one workbook to all workbooks in another folder

和自甴很熟 提交于 2020-01-16 18:55:11
问题 Add worksheet to workbook using VBA I am looking to copy an existing (already created worksheet) into about 500 workbooks (*.xlsx) that all reside in the same folder. I was able to cobble together the below code from various other topics on here but I am not able to get it to work. Private Sub Command0_Click() Dim file As String Dim myPath As String Dim wb As Workbook Dim rng As Range Dim wbMaster As Workbook 'if master workbook already opened 'Set wbMaster = Workbooks("ProjectBabelfish.xlsx"

Hyperlink to Worksheet in actual Workbook

本小妞迷上赌 提交于 2020-01-14 16:48:07
问题 How can i add a Hyperlink to a specific cell and address it to a Worksheet in the Excel file? This is what I already got: Cells(zeile, 1).Select Worksheets(1).Hyperlinks.Add Anchor:=Selection, Address:=Workbooks(1).Worksheets(fortnr), SubAddress:=Cells(1, 1).Address Thanks. 回答1: ActiveSheet.Hyperlinks.Add ActiveCell, "", Sheets(fortnr).Name & "!A1" The Address should be blank and the SubAddress should be in the form Sheet1!A1. This puts a link in the activecell assuming you have a variable

Adding Sheet Names to Array in Excel VBA

房东的猫 提交于 2020-01-13 19:09:00
问题 I am trying to add sheet names into an array in Excel VBA using the code below. It is only picking up one value (always the last worksheet name). For example, if I have 2 sheets: List1 and List2, it only picks up List2 and shows a blank value for the first sheet. If I add 4, it only shows the 4th, and so on. I'm not sure why I'm getting blank values. Dim curSheet As Worksheet Dim ArraySheets() As String Dim x As Variant For Each curSheet In ActiveWorkbook.Worksheets If curSheet.Name Like "

Excel data checking

倾然丶 夕夏残阳落幕 提交于 2020-01-06 15:59:46
问题 Excel data checking I have an Excel UserForm which contains the following fields; date , name and work . In the event that the worksheet contains the same date and name pairing, I want data transfer from the Userform blocked. Example A worksheet has one entry: Column A has the date 1/1/2017 Column B has the name john For the worksheet above, the following rules apply: Information can be passed from the UserForm for 3/1/2017 and john . Information can be passed from the UserForm for 1/1/2017

Dynamic Depending Lists in Separated WorkSheets in VBA

。_饼干妹妹 提交于 2020-01-05 12:58:21
问题 I'm not really expert in VBA and I have a problem with my code and I don't know how to solve it. (The code is from: http://siddharthrout.wordpress.com/2011/07/29/excel-data-validationcreate-dynamic-dependent-lists-vba/) I'm working with 8 dynamic dependent lists, and I thought the best way to automate the process and avoid to modify the macro in a future if I modify the lists was a VBA code. Trying to find the correct code, I'm just working with to lists. For after, apply it for all lists. I

Save each worksheet in workbook as an individual pdf

亡梦爱人 提交于 2020-01-05 05:30:10
问题 I want to loop over all worksheets in a workbook and save them as individual pdfs in the same path as the workbook. The files are named after the worksheet name. This code below works up until the "wsA.ExportAsFixedFort" line. The error message i get is: Run-time error '91': Object variable or With block variable not set But i cant figure out what the issue is... Any suggestions? Option Explicit Sub WorksheetLoop() Dim wsA As Worksheet Dim wbA As Workbook Dim strTime As String Dim strName As