Adding This To A Macro
Jan 5, 2009
I have the following code i want to add to the code at that bottom:
With combobox1Data
If .ComboBox1 = "" Then
MsgBox "All location must be selected"
Current code is:
Private Sub cmdDone_Click()
End Sub
Private Sub CommandButton1_Click()
Dim TheName As String, Response As VbMsgBoxResult
TheName = ComboBox1.Value
Response = MsgBox("Are you sure you want to remove " & TheName, vbYesNo + vbQuestion)
If Response = vbNo Then Exit Sub
Range(TheName).Offset(-2).Resize(Range(TheName).Rows.Count + 2).Delete Shift:=xlUp
Names(TheName).Delete.....................
View 9 Replies
ADVERTISEMENT
Oct 3, 2008
I have a Macro that I use often - It cuts a Designated Row from my AMZ-GM Open Sheet and moves it to the first open row of AMZ-GM Sold and leaves Cell U in that row Copied to the clipboard.
I would like to add two more jobs to that macro but am having a hard time.
1. I currently start the process in AMZ-GM Open.xls by Control F to find the SKU Number for the item I want to move ( it is always in Column N ) - I then manually highlight the entire row and run the macro below.
I would like to add code to my macro to highlight the row that my SKU cell found is in.
SO.... I want to start my macro from a single chosen cell instead of a chosen highlighted row.
I need to start my macro from the chosen cell in Column N. I need to add code to Highlight the row that my active cell is in and then proceed with the rest of the macro.
I recorded a macro starting with a cell -highlighting the row but it records as a specific cell / row number. I dont understand how to make it based on what ever cell is shown as active.
2. I would like to take the copied cell text ( U ) that remains from the last command and insert it into an open Word Document ( Amazon Sale.doc) at the position of the cursor in the that open Word Document. I'm not finding much info on moving that cells text to Word.
Heres my current Macro
--------------------------------------------------------------
Sub OpentoSold()
'
' OpentoSold Macro
' Macro recorded 2/1/2008 by Mike
'
' Keyboard Shortcut: Ctrl+q
'
Dim objLastRow As Range
Dim lastRow As Integer
Selection.Cut
Windows("AMZ-GM-Combine.Xls").Activate
Windows("AMZ-GM Sold.xls").Activate '
Set objLastRow = ActiveSheet.Cells.SpecialCells(xlLastCell)
lastRow = objLastRow.Row + 1
Rows(lastRow).Select
ActiveSheet.Paste
Range("U" & lastRow).Select
Selection.Copy
End Sub
------------------------------------------------------------
View 9 Replies
View Related
Mar 28, 2009
I've added the following code into macro i have assigned to the button on this attached worksheet which deletes any row where the cell in the A column is blank.
View 6 Replies
View Related
Aug 2, 2012
I want add one more criteria that if i have "Completed" & "Already Completed" i need both the criteria need to move to the next sheet name resloved
I try in the below macro to add but i am unable, how to add the criteria for the below macro
Sub Shift()
Dim r As Range, LR As Long
With Sheets("Details")
LR = .Range("A" & Rows.Count).End(xlUp).Row
LC = Sheets("Resolved").Cells(1, Columns.Count).End(xlToLeft).Column
Set r = .Range("A2").Resize(LR - 0)
[Code] .....
View 2 Replies
View Related
Jul 17, 2007
How to add checkbox to specific cells? I would like to add one checkbox to "A2" then "A5" then "A8".... upto 101.
View 9 Replies
View Related
Jul 19, 2007
I've got a userform which adds Textboxes automatically depending on a certain value. And the amount of Textboxes varies from 1 - 100. I add them with the line:
Set MyControl = UserForm1.Frame1.Controls.Add("forms.textbox.1", strControl, Visible)
Now my question is:
Can I add a macro to each of these textboxes automatically? A macro for the Change event I think it is.
All textboxes would have the same macro.
I kinda hoped it would be one of the following:
MyControl.OnAction = "test"
MyControl.Change = "test"
View 9 Replies
View Related
Dec 18, 2009
I'm using this Macro to add a new row and it is adding the row just fine, but I would like only the content added in row B, C, D, and the rest of the rows left blank. It also will copy and add all rows right except for row 4 wich is the burnsville row. I have the macro attached to the shape in B 1and 2.
Sub InsRow()
Dim iRow As Long
iRow = InputBox("Enter row number")
Rows(iRow).Insert
Rows(iRow - 1).Copy
With Range("A" & iRow)
.PasteSpecial Paste:=xlPasteFormulas
.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End With
End Sub
View 10 Replies
View Related
Jun 30, 2014
The way the code works right now is that I have it run as a few loops. it will first loop through the first worksheet in the array and delete what I need and then when that loop finishes it will run two macros that I have added in, then it will loop to the next worksheet in the array. right now it is only 2 sheets but eventually it will be many more. just working out the code for now. What I would like to do is in the second loop. my second macro in the code formats each page and, what I would like to do is add a date column to my code. I need to start at 1/05/2014 and then for the next iteration in the loop add 7 days.
[Code] ......
View 5 Replies
View Related
May 5, 2008
i have a macro that richard buttrey has so kindly helped with
View 14 Replies
View Related
Nov 3, 2008
I am extending rows on a salary schedule. As you can see below, the rows include: Bargaining Unit (GP) Schedule(2A) Range(5) Step (A) Hourly (S) and the hourly wage(11.52)
GP,2A,5,A,H,11.52
GP,2A,5,B,H,11.82
GP,2A,5,C,H,12.17
GP,2A,5,D,H,12.5
GP,2A,5,E,H,12.88
GP,2A,5,F,H,13.22
GP,2A,5,G,H,13.61
GP,2A,5,J,H,14.18
GP,2A,5,K,H,14.71
GP,2A,5,L,H,15.26
GP,2A,5,M,H,15.83
The Steps currently go from A thru M but I need to add N thru Z and after step M there is a 3.75% increase for each step.
You can see that this is a csv file (comma delimited). All of the other info needs to autofill and only the new steps (N-Z) will change and the wage for each of the new steps. The last row is 2 decimal points.
View 8 Replies
View Related
Nov 5, 2008
adds the file name into column A if it could also hyperlink it to that file. 2nd, Change it so it doesn't start a new workbook and worksheet. I would like it to just run in the Workbook it is in and each time the macro runs or the workbook opens it updates any info that has changed.
View 5 Replies
View Related
Dec 9, 2008
I had a working macro before i added an extra row for another entry (No. of Hours spent). The entire data collection calculates the total price of a project (called PSR) in another cell underneath. The macro is suppose to move the entire data into another sheet to keep a history (in Sheet2). I've attached the file containing the workbook.
View 2 Replies
View Related
Feb 25, 2009
Basically it's to make my content management easier.
I have made a button and assigned a macro to it. At the moment the button creates a new column and makes it the right size etc.
View 14 Replies
View Related
Oct 8, 2009
When adding a comment I check for an existing comment, if exist then delete and add new comment and some text in that cell. This works as long as the cell has an existing comment; other wise it advances to the "Else" where I thought I would be entering a comment and text in an empty cell. Why does my macro treat an empty cell as if it has a comment?
View 4 Replies
View Related
Feb 23, 2010
I´ve made a simple macro in order to make easier to add new rows in a table, by filling the cells with the new data.
The problem is that according to one of the fields, I´d like that macro to add multiple rows, with exactly the same information but numbering all these rows on this specific field from 1to the number I filled on the respective cell.
For example, I have beyond another fields that I´ve already filled, the field "Parcel" and "Total of Parcels". I filled parcel with number 1 and total of parcels with 5. Then I´d like the macro to add 5 rows with the "total of parcels" cells containing 5 on every row and the field parcel filled with number 1, 2, 3, 4 and 5, for each row created.
View 14 Replies
View Related
Jan 22, 2013
I am wondering if it is possible to use a formula or IF statement within a macro to add a single row at a time if a cell shows as False? For example, if the value in column AD is False, I want it to add a single row under that row that has False. However, if the value in column AD is True, I don't want it to add a row and skip to the next record. I need it for approximately 500 records.
View 2 Replies
View Related
Mar 8, 2013
I'm looking for a quicker way to take a list of numbers and adding commas, then putting them in the same cell so I can input them into a web database much faster. I can do it long hand by using concatenate first on the list to add commas to each cell, then making another concatenate to put them all in one cell, but doing the latter takes quite a while because of having to input each cell into the formula. Is there a way I can combine the 2 into a macro to accomodate for any length of cells?
Example, I have this list
12
13
14
15
16
17
As my list of numbers, and I need it to look like this in one cell:
12,13,14,15,16,17
View 5 Replies
View Related
Mar 21, 2013
I would like to add a pause to the following macro so that it inserts the word CANCEL 1 second after triggering. I know I need to use the Application.Ontime function but cannot work out how to integrate it.
Code:
Sub Cancel() Application.ScreenUpdating = False
Sheets("Sheet1").Range("T5") = "CANCEL"
Application.ScreenUpdating = True
End Sub
View 3 Replies
View Related
Aug 19, 2013
This macro has a problem in that it totals up the colunmns in two places by error
The total should be at the end of the coumns only.
It gives me a total part way through the list which muddles things up a bit.
Sub prepareSAPexport()
'
' prepareSAPexport Macro
' prepare the sap export ready to be compared to CDS
'
' Keyboard Shortcut: Ctrl+s
'
Range("A1").Select
[code]....
View 1 Replies
View Related
Nov 17, 2013
VBA COde for adding CC, BCC to email sent from excel. I already have the below code to send email from worksheet, i need to add a copy email.
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
[Code].....
View 5 Replies
View Related
Jan 10, 2007
Im trying to autimatically insert a RTD formula in a cell but it is failing trowing the error 1004 : 'runtime 1004: application-defined or object-defined error'
Here is the ....
View 5 Replies
View Related
May 6, 2007
How can i add a keyboard shortcut in already saved macro. Is there any way to do it or need to write a new macro?
View 2 Replies
View Related
Jul 20, 2007
i am completely new to writing macros. have recorded a macro but have just found out the each of the new sheets that the macro creates needs a line at the top of the sheet with a title in it
View 2 Replies
View Related
Aug 10, 2014
I would like to add a "subroutine" to my macro to show the numbers it is picking. But I am having a problem figuring out how to do this.. Here is my macro...
Sub generatelottery2()
Const l& = 1 'lower value
Const u& = 49 'upper value
Const n& = 6 'number of numbers per draw
[Code]....
View 3 Replies
View Related
Jan 27, 2014
I was given a spread sheet with a number of payments on it, I was asked to take the "four" potential payments and only show one total payment. There are 2900 lines in my file and as you can see from the example the scenario repeats it self with the "four" payments all the way to the bottom. I would like to be able to add H2 to H5, total that number in J2 and delete row 3,4 and 5. This then has to be continued all the way down to line 2878 where I could then run a macro I have to delete blank rows cleaning my spreadsheet up. I would take a looping or user controlled macro (ctrl +) so I don't have to do this manually.
Sample_total.xls
View 4 Replies
View Related
Feb 20, 2014
The below code works well. However I would like to give the users an option to opt out of running the code when the message box appears.
Code:
Sub delete_sheets()
Beep
MsgBox "This will delete All Sheets but the active sheet"
*****this is where I would like to use an additional message box or include it in the above message box an option for the user to cancel this code****
Range("XA1") = ActiveSheet.Name
ActiveSheet.Name = ("Delete_Sheets")
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Worksheets
If Not ws.Name = "Delete_Sheets" Then ws.Delete
Next ws
[code]....
View 1 Replies
View Related
May 26, 2014
I have the macro to insert rows every nth row, but need to be able to insert text into that nth row.
I have a list of addresses and every 10 addresses i need to insert a 'seed' which will be have the same details everytime. This is what i have so far...
Sub InsertRowsMod10()
Dim r As Long
r = 10
Do Until Len(Cells(r, 1)) = 0
Rows(r).Insert Shift:=xlDown
r = r + 10
Loop
End Sub
View 2 Replies
View Related
Jul 3, 2014
Below Macro which I am using to extract .PDF files. Now, I also want to see the Date moified while extracting the .PDF files. Hence, adding date modified to this macro.
Sub get_pdf_name()
Dim FR As Long, sh As String, FPath As String, FName As String
sh = Sheets("Sheet2").Name
FR = Sheets(sh).Range("A" & Rows.Count).End(xlUp).Row + 1
[Code] .....
View 1 Replies
View Related
Jan 14, 2013
I am having difficulty expressing a formula so that if a cell is greater than zero, it adds the value of that cell to a String figure. I have got as far as the following, the 'problem' area is in red.
Sub Share_Sales3()
Dim Prompt As String
Dim Caption As String
[Code].....
View 3 Replies
View Related
Aug 19, 2013
I would like to have a macro designed. I have 2 workbooks, one having latest information and the other having the information in database already. both workbooks have 26 columns each. I would like to check if a value that exists in Column A of the "latest-information" workbook also exists in the "already-in-database" workbook. If so, I would like to update all 26 columns of that row in the "already-in-database" workbook with information from the "latest-information" workbook. If the value does not exist, I would like to add all 26 fields in that row into a new sheet on the "already-in-database" workbook.
View 3 Replies
View Related