situation: if cell I22 in Sheet1 = "MFRHTC", a message box will pop up and give the user some info and at the same time ask if this is a Fed Ex shipment
if user selects NO, then nothing will happen
if user selects YES, then the user willl be directed to cell L15 in Sheet2 in order for them to input their ship to address
here is what I have so far:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("I22"), Target) Is Nothing _
And Target.Value = "MFRHTC" Then
Msg = "Units will provide the following in order to have ammunition Fed Ex to HTC's " & vbCrLf
Msg = Msg & "" & vbCrLf
Msg = Msg & " POC" & vbCrLf
Msg = Msg & " Unit ship to Address / CANNOT BE A P.O. BOX" & vbCrLf
Msg = Msg & " Phone Number" & vbCrLf
Msg = Msg & "" & vbCrLf
Msg = Msg & "" & vbCrLf
Msg = Msg & "Input the required info in the Fed Ex ship to address Box"
MsgBox Msg, vbInformation, "FED EX AMMO INFO REQUIRED"
If MsgBox("IS THIS A FED EX SHIPMENT REQUEST", vbQuestion + vbYesNo, "SELECT EITHER YES or NO") = vbYes Then
I have the following coding that I have tried in both the Sheet code and as a module at different times.
Sub CopyEmployed() Sheets("Employment").Select Range("A3:L200").Select Selection.ClearContents Range("D4").Select Sheets("Act1").Select
- And there will be more here when I can get this first part working-
When I step through this works up to "Selection.ClearContents" but then ignores the next two lines
Range("D4").Select Sheets("Act1").Select
and goes straight to the Private Sub coding below that I am using to change the sheet tab names (This is in the ThisWorkbook section and works perfectly)
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim LinkedCells As Range Dim ArrayOfMatchingSheets As Variant Dim i As Long Set LinkedCells = Sheets("Menu").Range("E8:E22") [Code] ....
I can continue to step through this until it eventually returns to
Range("D4").Select Sheets("Act1").Select
It may then run the remainder of the coding but what I have tried so far produces more Runtime and type mismatch errors which I will post after I can fix this.
Bottom line is I dont want the change sheet tab code run - I need the remainder of the Sub CopyEmployed() to run.
Im using the following code to assign numerical values to words in two columns, then multiplying the values together and painting a cell with a specific color assigned to the final number. The problem is it wont do this past row 19
mLastRow = Sheet3.Cells(Rows.Count, "I").End(xlUp).Row For m = mLastRow To 5 Step -1 ' assign numerical values to the words in these columns e = 22 r = 23
' Give Extent a value If Cells(m, 9) = "Minor" Then Cells(m, e) = 1 End If If Cells(m, 9) = "Moderate" Then Cells(m, e) = 5 End If If Cells(m, 9) = "Serious" Then Cells(m, e) = 8 End If If Cells(m, 9) = "Critical" Then Cells(m, e) = 10 End If....................................
We currently use Excel to make reports of data obtained in field surveys. General data is repetitive throughout report. We have a title page, general particulars (GP) page, table of contents then data table pages. Each data page has info from general particulars page. i.e project name, date, inspector etc. Right now some cells of data table pagess have formulars pointing to applicble cells on GP page.
Presently I am designing a userform to input title and GP page data. So far OK.
Question: Can I take input on userform and add to footer. Info to be added after or inserted within text already there? i.e. Surveyors Name: ?(left footer) something center and something right. What type of code needs to be added and where do I place it .
I have to type in a long place name with 10 letters repeatedly and whereas before Excel completed it after I typed the first two letters it has now stopped doing so. Is there a way to reactivate this facility? Other names do get auto-completed when typed in the same column.
I have got Names in column A and Join_Date in column B. In column C I want those whose Probation period is going to finish this week. Probation is of 90 days.
First sheet has a client name and several cells of data along the same line. All of the data on this sheet is kept long term.
The second sheet is completed copied and deleted. In completing the second sheet the client name is selected of a drop down list and pulled from sheet one.
What I want to do and not sure if there is a way is that when I select a client and populate it on sheet two I would like the related data on that clients line from sheet one to populate to same named lines on sheet two.
if this is possible and if so provide a brief description of how it would work
How to use conditional formatting in Excel 2007 (). I'm creating a spreadsheet to track my group's timeline for completing strategy meetings with our customers. When we have a meeting, I will enter the date of that meeting in a specific cell. In a successive column(s), I'd like for a cell(s) to turn a specific color based on the length of time from the last meeting (or if there is no date for a meeting entered - i.e. no initial meeting has been set).
I use excel 2002 but some of my office are on 97, i want to add a small workbook open event code which works for me but debugs for the others?? The code is basically, go to a tab, on that tab and that range sort..
I've developed a little software using Excel Macros & VB. To prevent people from accesing the code I protected the code blocking it from visualization. It seems not enough as an acquaintance of a friend cracked it in 25 minutes. Or so he says. So I'd like to know if there is a better way to protect the font code.
I have an excel file having part code,name,vendor and Qty ( Quantity ).
My problem is that I want to apply an excel formula to pick up that vendor code who have highest Qty of a part code.The condition is that S.No.should not be disturbed.This file is so large,but here I have taken an example,
I am dealing with several very large spreadsheets using VBA to do various things. I found that my code worked well, but was taking a long time to run. The biggest time consumer was my use of the AutoFilter features. I have since turned calculations to manual before my code runs and set it back to auto when my code is done running. What are the potential consequences of my turning calculations to manual and then back to auto?
I have previously used the following code to successfully pull out IE webpage source code for string manipulation.
Its a crude example to demonstrate the principle:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public IE As Object Sub Sample() Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True
[Code] ......
However when I substitute in a Google websites address into the IE.Navigate command, the code runs to the "Source_Code = IE.document ...." line then flags up a Microsoft Visual Basic error. "Run-time error '438': Object doesn't support this property or method"
The webpage that I am trying to access is a confidential company site, so you won't be able to access it yourself, but starts with [URL] ......
The one thing that I have noticed about this website is the Privacy Report icon in the lower right status window (Picture of an eye with a restricted symbol in front). I don't know whether this is the cause of my problem, or purely an incidental observation.
Is there something peculiar with Google sites that means that the source code cannot be extracted in general, or is this an issue specific to my site ? Does the Privacy Report icon have any relevance, and if so how do I switch that off ?
My company has files that are already in use. I don't know too many details about how they work, but somehow saving the file will screw it up and my boss has to go back and reset something or other to correct it. Obviously it's connected to some other software somewhere. The code below will block Save and Save-As. BUT how do I get the file to hold onto the code without actually saving the file after the code is added (since the file shouldn't be saved)?
VB: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI = False Then Cancel = True
I have some buttons in different sheets in an excel file, each button has its own code, that is the reason I can not move the code related to each object to another location (sheet or module).
And I have one piece of code in Module1 (Auto_load) in order to execute automatically this routine every time file is opened. Inside "auto_load" routine I initialize some values of some check buttons,options buttons and positions of some objects in diferent sheets, but I can not pass the value of variables between Module and Sheet's code even when I declare as public variables and/or function.
I'm trying to write a VBA script which will delete all rows in my Excel spreadsheet where Column I (which contains a status code) does not contain the word "Completed".
At the moment, I'm doing this the other way round: my script is able to search for entries in Column I which contain the status codes "Pending", "Awaiting Authorisation", "In Progress" etc and delete them. The idea is that when all those rows are deleted, I'll only be left with rows which have a status of "Completed". This works fine at the moment. However, the concern is that if a brand new status code is added to the data file, my script would be unable to pick it up and delete it. This is a small sample of the code I'm currently using (which deletes all the rows with statuses other than Completed):
I am trying to determine how to get the code below to fire whenever cell J10 is populated and do nothing when cell J10 is not populated but I can't quite get it. (Cell J10 is manually changed and is not changed based off of a formula)
Is there a standard way to organize sections of code with code tags? Due to the nature of my work, there is a lot of documentation involved. And, my spreadsheets rely heavily on VBA. These code tag sections will be going into a design specification, so that there is a layer of traceability from the document to the program. These are the general sections or item numbers that I've come up with.
1. Dimensions and Variables
2. Data
3. Processing the Data
4. Rules of analysis
5. Analysis
6. Formatting
I guess I'm looking for something standard like UML diagrams for DFDs, but with tagging code to break them up into sections?
I am using the code below that I got off of these forums to email a particular sheet in my workbook, but I need to strip all of the VBA code and the command button from the sheet being sent.
I have problem to change text code into numerical code using macro. i have data contain text code and i would like to convert it into numeric . each text code has dedicated numerical code for example I have 4 fluids with text code text code:
FW = Fresh water SW = Saline eater CW = connate water MW = Meteoric water
numeric code as follow
FW=1 SW=2 CW=3 MW=4
I would like to convert the text code into numeric code, it is easy if using excell , but it is routine job for me , i need to create macro to be more simple .
What is the most efficient VBA code for the following macro recorded codes? I wish to write more efficient code versus the lengthy, cumbersome macro recorder code.
1) Macro Recorder Code to Copy One Sheet to Another
I have been trying to track down why this message keeps on popping up, doesn't matter what excel file I open it always pops up, code will halt at different times in the code.
I am looking for VBA code by which the results can be obtained without having to run the code. For Instance, if Z = X*Y, I would like the code to automatically calculate Z for as soon as the value of X and Y are changed.
I have implemented the code for the FuzzyPercent code as a module and Excel will not recognize the function for the cell (=fuzzypercent($C$3,$B5,D$2)). I am using Excel XP.
Sub Increment() Dim Lr As Long Lr = Cells(Rows.Count, "A").End(xlUp).Row If IsNumeric(Cells(Lr, "A")) Then Cells(Lr + 1, "A").Value = Cells(Lr, "A").Value + 1 End If End Sub
This adds 1 to the previous cell and displays in the next available cell.
How could I make it sao that when this number enters in the cell it hyperlinks automatically to the master file?
Before this button was introduced I used this:
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean) On Error GoTo Err_App_WorkbookBeforeSave
Dim hl As Hyperlink
For Each hl In Me.Hyperlinks If Wb.FullName = hl.Address Then Application.EnableEvents = False Cancel = True..............
I have code that inserts columns, inserts formulas, and then copies the formulas to the last row of data. It all works good but for some reason, the columns that are being copied, are being copied past the last row of data. It can always be determined how far down it will be copied. Examples: if the last row of data was row 4, then the formulas would be copied down to row 24, if the last row of data was row 54, then the formulas would be copied down to 254, if the last row of data was row 284, then the formulas would be copied down to 2284. I can not figure out how and wh this is happening, but whatever the last row of actual data is on the spreadsheet, there is a 2 being placed in front of the last row of data and the formulas are being copied down to whatever the last row is with the addition of a 2 in front.
Here is the code for the columns additions, and formulas:
If the last row of data was row 54, then columns O:S would have the formulas copied down to row 254.
How can this code be modified so the formulas will not be copied past the last row of data?
How do you get the code boxes to appear in these threads. I do not know how to do this. As you can see, all I did was copy and paste my code in this thread.