Add In A Text Box Prompt That Will Modify Code

Apr 29, 2009

how to add in a text box prompt that will modify code?

View 4 Replies


ADVERTISEMENT

Modify The Code

Jun 12, 2008

I have a code here, which thanks to Jindon helps on yesterday, But now, I want to change the code to count by column instead of rows, to continuous copy & paste my date,
How can it to modify:

Sub test()
Dim home As Worksheet
Dim Filename As String, myDir As String, fn As String
Set home = ThisWorkbook.ActiveSheet
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
If .Show = -1 Then
Filename = .SelectedItems(1)
myDir = Left$(Filename, InStrRev(Filename, ""))
fn = Mid$(Filename, InStrRev(Filename, "") + 1)
With home.Cells(Rows.Count, "E").End(xlUp)(2).Resize(2)
.Formula = "='" & myDir & "[" & fn & "]MAN_SUM'!k6"
.Value = .Value
End With
End If
End With
End Sub

View 9 Replies View Related

Modify (PDF Code )

Feb 9, 2010

Find below a vba code that i attached to a button that converts my print area in excel to PDF via Cute PDF writer.

Sub PDF_Sheet()
Dim Filename As String

With ActiveSheet

Filename = .Range("A1")
.PrintOut Copies:=1, ActivePrinter:= _
"CutePDF Writer on CPW2:", Collate:=True

SendKeys Filename & "{ENTER}", False
End With

End Sub

I need a VBA code for the Excel sheet that i am cuttently working in that will do the following:

i have text and pictures in range O86:W97 that must be automaticaly romoved & replaced by another range after the above mentioned code hase complete

the range that must be replaced with the following,
O101:w112 Pdf code must run then
O113:w124 pdf code must run then
O125:w136 pdf code must run then
O137:w148 pdf code must run then
O149:w160 pdf code must run then

note that the ranges run in a sequence 101to112 then 113to124 then 125to136 and so on

Now this needs to be repeated 190 time starting from range O101:w112. The range O86:w97 forms part of my print area of A1:W97, this means i will have 190 PDF saved pdf sheets when i the vba code is complete.

View 9 Replies View Related

Modify This Code To Save As .CSV?

Sep 28, 2009

modify this code to save as .csv? I tried just putting it after the file name and that didn't work.

View 2 Replies View Related

Modify Ranking Code

Jan 30, 2010

Is it possible to modify this code so that it will give the lowest values the opposite ranking from which it is now. (Please take a look at the example sheet)....

View 5 Replies View Related

Modify This Code To Add-up Numbers In COL-D

Jun 20, 2008

It's a linked post from:
[url]


I managed to do the combine the row if column B matches. However column D(quantity, number value), i want the quantity to add-up if column B matches. Any idea how do I modify the code below to do that?

for example:
TDG-**002 Tuna Cheese Pizza Bar (KG) KG 30
TDG-**002 Tuna Cheese Pizza Bar (MG) MG 30
TDG-**002 Tuna Cheese Pizza Bar (KG) KG 30

will combine to become
TDG-**002 Tuna Cheese Pizza Bar (KG) KG 60

View 9 Replies View Related

Modify Code To Always Centre The Picture

Dec 3, 2008

I got this code from someone who is not currently available,
I modified it a little so that when I pick a picture it always lands on j96, but I need it to line up exactly on top of the picture underneath it
I have also attached a sample.
The pictures will always be exactly the same size

View 7 Replies View Related

Modify Code To Copy Only Value Not Formulas

Apr 7, 2009

Thanks everyone that has helped me with this so far. I am very new to VB so I definitely appreciate all the help.

I have the following code to select rows that meet 2 different criteria and copy them to a new sheet.

The problem is I only want to copy the values not all the formulas - the formulas don't work in the new location as they are referencing cells that are no longer there.

View 6 Replies View Related

Trying To Modify Code To Track Changes In Two Workbooks

Aug 28, 2009

I was trying to see if this code would work for my application where I want to compare two forms. Basically the master is filled out and then sent to a vendor. When it comes back from them rather than going through then entire thing and trying to determine if they changed or added anything manually I was hoping to use something like this code to do it.. I tried this code using a similar setup, basically a master file and an update file but it wouldn't actually populate the changes in the changes sheet on the master form..

View 3 Replies View Related

Modify VBA Code Written By Tom Urtis

Jan 22, 2008

I am using the following code, slightly modified, written by Tom Urtis.

I would like to enhance the code such that it will filter on two criteria to enable more specific results to obtained e.g. from the possibilities below I would like to get "Jones Manchester".

Data list:-
Jones Blackburn
Jones Liverpool
Jones York
Jones Manchester
Jones London EC1
Jones London N12

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address "$D$1" Or .Cells.Count > 1 Then Exit Sub
ActiveSheet.AutoFilterMode = False
If Len(.Text) > 0 Then
Dim myVal$, myVal2$
myVal = .Value
myVal = "*" & myVal & "*"
If WorksheetFunction.CountIf(Columns(1), myVal) > 0 Then

View 9 Replies View Related

Modify Code To Create Worksheets

Dec 12, 2008

I have this code that will create 3 worksheets with the name "New Name" and the # ( 1/2/3 ) ..

How would I change the code if I want 3 worksheets with different name?
Like Sheet1 then Sheet 2 then Sheet3 or any other name?

'To add worksheets and change name with one code
For i = 1 To 3 'Creates 3 worksheets
Set ws = Worksheets.Add
ws.Name = "New Name" & i
Next i

View 9 Replies View Related

Modify Code To Have Popup Box For Input

Jun 12, 2009

I wanted to change a column text to call intial Caps. I found this macro code on the microsoft web site

Sub Proper_Case()
' Loop to cycle through each cell in the specified range.
For Each x In Range("C1:C5")
' There is not a Proper function in Visual Basic for Applications.
' So, you must use the worksheet function in the following form:
x.Value = Application.Proper(x.Value)
Next
End Sub

I need to change the macro to have a input box (asking what column to convert text to initial CAPS)

View 9 Replies View Related

Can You Modify This Code To Search Only One Colomn?

Jul 3, 2006

Private Sub CommandButton1_Click()
Dim strFirstAddress As String
With Sheet1.UsedRange
Set rngFind = . Find(ComboBox1.Text, LookIn:=xlValues)
If Not rngFind Is Nothing Then
strFirstAddress = rngFind.Address
Do
rngFind.EntireRow.Copy sheet3. Range("a" & sheet3.Rows.Count).End(xlUp).Offset(1, 0)
Set rngFind = .FindNext(rngFind)
Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
End If
End With
Unload UserForm2
UserForm4.Show
End Sub

The problem is it searches the whole sheet, what I want it to do is only search one colomn (colomn A). I know its prob an esay thing to change but I can't for the life of me do it!

View 3 Replies View Related

Code To Create/modify/save Templates..

Dec 11, 2009

I have quite a few Excel templates that need to be modified by changing/adding information or sheets to them. Instead of working through the lot manually, it would be good if I could do the same through code. With my little knowledge I can do this for workbooks. Need to typical code snippets or suggestions? e.g. to open a template file, save it with the original name, etc. The usual Dim srcWB as workbook, Set srcWB= ABC.xls and Workbooks(ABC.xls). open do not seem to work with template files (ABC.xlt)

View 5 Replies View Related

Protect Sheet But Allow Macro Code To Modify

May 24, 2008

I am trying to design a tool which dynamically results in different cells depending on users inputs. Yet, I am willing to protect most of the cells to avoid any user involuntarily (or voluntarily!) modifying the formulas/contents of the calculated (and locked) cells. Is there any way to protect my sheets, allowing only a certain macro to modify the locked and protected cells?

View 4 Replies View Related

Password Prompt - VBA Code Advice

May 11, 2006

I have created a workbook that mostly works with VBA codes. Within the code I have ensured that certain worksheets remain hidden. However, I have also written a macro to access what I called the ADMIN worksheet, which has several commands enabling updates and troubleshooting. Long story short, I would ideally like to prevent users from accessing that worksheet. I have already created a prompt (Msgbox) asking the user if he/she wishes to proceed with the macro but I would prefer being able to have a password prompt to run the macro.

View 4 Replies View Related

Modify Code To Change Cell Background Color

Nov 11, 2008

I have the code below set to change the background color based on certain conditions. What I need to do is change it so that if none of the conditions are met, it does not change the color at all. As it is written now, if anything is entered in a cell that has a background already set, but does not meet these conditions, the cell turns white.

View 4 Replies View Related

Code To Copy Contents Of DDE Feed - Modify Worksheet

Dec 14, 2011

I am using the following code to copy the contents of a DDE feed.

Code:
Private Sub Worksheet_Calculate()
Worksheets("Sheet2").Range("A1").EntireRow.Insert Shift:=xlDown
Worksheets("Sheet1").Range("A3:F3").Copy
Worksheets("Sheet2").Range("A1:F1").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub

What I want to do is only copy the row when the columns contain data, as it stands at the moment it's copying blank rows to sheet 2. Is there a way that I can do this?

View 3 Replies View Related

Msgbox That Will Prompt For Answer Before Running Code

Apr 28, 2009

I need a MsgBox that will prompt for a Yes or No response. If you answer Yes run the code below if you answer no just stop and leave me in the current sheet.

View 10 Replies View Related

Code To Bypass Outlook's Security Prompt

Sep 11, 2005

when sending an email in code from Excel through Outlook, the following Microsoft Office Outlook dialog appears during code execution in Office releases since 2002:

A Program is trying to automatically send e-mail on your behalf.
Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No".

Two buttons: [Yes] [No]

Question

Has anyone used or developed code that bypasses this prompt, and if so, would you please post an example of your code here. What I would like is a macro in VBA and / or API that you know from your own first-hand experience has worked for you, that emails an Excel attachment from Excel, using Outlook (not Outlook Express) as the email client, which bypasses the above prompt.....................

View 9 Replies View Related

Security Prompt Even After Deleting Macros Using VBA Code

Jun 27, 2007

I have used the following Macro that deletes the Macro code. It then saves the file and quits excel.

*************************************
Sub removeAllCode()
Dim awi
Dim awcl As Integer
Dim count As Integer
Dim i As Integer 'loop counter
On Error Resume Next
count = ActiveWorkbook.VBProject.VBComponents.count
For i = 1 To count
Set awi = ActiveWorkbook.VBProject.VBComponents.Item(i)
awcl = awi.CodeModule.CountOfLines
awi.CodeModule.DeleteLines 1, awcl
Next i
Set awi = Nothing
ThisWorkbook.Save
Application.Quit
End Sub
*************************************

However when I open the Excel File, I still get the Macro Prompt. I have checked in Macro list as well as in VB Editor and no Macro code exists

If I have the file manually (or do a save as) and then reopen the file, I no longer get the Macro prompt.

I have tried various examples listed in different forums/sites but nothing works.

View 9 Replies View Related

Keep Code Running When Message Prompt Shows

Mar 1, 2008

I have code to open another workbook and run a specific macro. I plan to then take that and copy it over to my workbook.

The problem I am encountering is when I run this macro, at the end of the code, a form/msg pops up stating it is complete. This then automatically stops my code from running (from my original workbook). How do I close this form in order to keep my code running?

View 3 Replies View Related

Modify VBA Code That Copies Multiple Sheets To A Master Sheet?

Apr 2, 2014

I found the code below and it works perfectly if I want to copy all the other sheets to a master sheet. But, I need to specify specific sheets. Basically I have a workbook consisting of multiple sheets and multiple "master" sheets so I need to specify in the code which sheets it should be copying.

[Code] ........

View 5 Replies View Related

Modify And Enhance Recorded Code - Delete Rows Based On Value

Aug 22, 2012

I searched many sites and used codes which delete Rows based on criteria. In my case those codes works, BUT it took so much time about 30 min since there is about 75 thsd rows, and that solution in not time saver. I recorded code below and it is done in seconds. make it dynamic, VBA, since number of rows is every month larger. Basicly, I need code which delete rows based on Column B, where walue is "R"

Code:
Sub DelRowsBasedOnOneCriteria()
'
' DelRowsBasedOnOneCriteria Macro

[Code]....

View 4 Replies View Related

CMD Prompt Code And Display Result (Hostname Or IPConfig)

May 31, 2014

Is there a way to use cmd prompt via vba?

I would like to run "HOSTNAME" and have that displayed as msgbox text.

I am hoping its fairly simple and diverse so I can just change the cmd code to suit.

E.g.

Code:
private sub gethost()
dim host as long
host = (CMDRUN) "HOSTNAME"
msgbox "your host name is " & host

There must be a way so would like to see but I am struggling to get results on search engines.

View 1 Replies View Related

Modify The Formula Entries In The Following Code To Cycle Or Loop Through All Checks Required

Feb 22, 2009

I'm working on a spreadsheet to compile and print checks. All the check information except the date and first check number is contained in a Wins sheet. I also have a Checks sheet which contains a master check. I used text boxes on the master check to contain individual check information. Each text box is filled in from the Wins sheet by means of formulas. The problem I'm having is how to modify the formula entries in the following code to cycle or loop through all checks required. A sample spreadsheet is attached.

View 2 Replies View Related

Messagebox Prompt Then Allow User To Enter Data Before Continuing Code Execution

Jun 11, 2013

Basically, in the "Thisworkbook" code , i have some code in the Workbook_BeforeClose section. Currently , it autosaves the workbook in a folder i have specified.

However, i need to add some code.I want to check that a certain cell has a value in it before the user closes the workbook, and if the cell is empty, show a messagebox asking him to enter a value.

I know how to get a messagebox to pop up, the only thing is once the user clicks the OK button,
i need the rest of the code execution to pause, allowing him to make the change then if he clicks the "X" (top right of the screen) to close the file or application, the filesave dialog appears and he can then save the document.

how to go about this because at the moment when user clicks ok, the messagebox just disappears and filesave dialog appears and he doesn't have a chance to edit the cell.

View 5 Replies View Related

VBA If Range Value = Something AND Another Cell Has No Entry- Prompt The User To Enter Data- My Code Is Not Working

Apr 20, 2009

I am trying to display a message box for the user if there is "agency" in cell o8 but nothing in p8... I tried the following code but it doesnt work..


If Range("o8").Value = "Agency" And Range("p8").Value = "" Then

MsgBox "Please provide name of agency in cell p8"

Sheet9.Shapes("cross").Visible = True

Else

View 9 Replies View Related

VBA - Copy Multiple Cells If Specific Text In Row Then Modify

Mar 7, 2012

I want some VBA code that will:

1) automatically check the active row to see if it contains specific text (i dont' care if there is other stuff in the cell or cells), such as "truck 1 blahblahblah" and checks for specific font color, such as green.

2) if the row does, then I want it to copy ALL the cells in the active row EXCEPT Column A (which contains the date), and then paste them twice, one 21 rows down from the active row, and one 35 rows down from the active row.

3) Once copied and pasted, modify the pasted cells slightly. The first pasted cells need to say Truck 2 blahblahblah in Column C and be in blue font (instead of the original Truck 1 blahblahblah in Green Font), the second needs to say Truck 3 blahblahblah and be in yellow font. Everything else that was pasted will be the same EXCEPT they will be in blue or yellow font.

View 2 Replies View Related

Excel 2010 :: How To Modify Text Content Of A Cell

Dec 12, 2013

I want to edit phone numbers in format 1112224444 to 111-222-4444.

My best shot has been...

Excel 2010 (Mac)

Sub EditPhone1()
ActiveCell.Offset(0, 0).Select
With ActiveCell
.Value = .Characters(1, 3) & "-" & .Characters(4, 3) & "-" & .Characters(7, 4)
End With
End Sub

I've tried many variations, no luck.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved