VBA USERFORM SCREEN SIZE
I tried to fit the vba userform with laptop screen size.But it is not coming properly.Kindly Suggest
See also questions close to this topic
VBA: Error 1004 when copying data from one workbook to empty row on another
Trying to automate some copy and paste work, where I've got a template workbook that when filled out the user will run a macro which will copy and paste a row from the now filled template document and paste it into the next empty row of another workbook. i keep hitting an error when i run it and i'm not entirely sure how to amend the code to allow it to work
Sub hello() ActiveSheet.Range(Cells(61, 1), Cells(61, 6)).Select 'selects the row of data from populated template Selection.Copy 'copies that row Workbooks.Open Filename:="destination workbook file path" 'opens destination workbook that needs the date pasted into ActiveSheet.Range("A1").End(xlDown).Offset(1, 0).Select 'selects the next empty row in destination workbook Selection.PasteSpecial xlPasteValues 'pastes values not formulas ActiveWorkbook.Save 'saves destination workbook ActiveWorkbook.Close SaveChanges:=True 'closes destination workbook End Sub
When i run it the error occurs on the line where it selects the next empty row.
VBA obtaining filename of last file in a directory
I would like to obtain the filename of the file that's in last place in a directory.
For example directory 'x' contains files:
I want to obtain the name of file 1004 so I can use it in a messagebox like this:
MsgBox("The last file is: " & FileName)
And the messagebox shows: 'The last file is 1004'.
Anyone who knows how I can achieve this?
How to rename worksheet incrementally based on cell value in excel vba
I have a spreadsheet with multiple values but the same structure through out. I want to rename the worksheet based on the cell value "E1".
However, there are multiple sheets with the same value in E1. How can I rename the worksheet abc01 (if cell E1=abc) and the corresponding sheets with cell E1= abc as abc02 and so on.
I have tried
Sub RenameWorksheet() Dim WS As Worksheet For Each WS In ThisWorkbook.Worksheets WS.Name = WS.Range("E1").Value Next WS End Sub
This code fails if i have more than one sheet with the same value in cell E1
Any help is appreciated...