I would like to prevent the user from inserting rows. I know that ater versions of Excel have built in "Protection" features which would easily accomplish this. Unfortunately, our company uses Excel 2000.
I have keyed in a constant value in cell B100 ("bottom" of the practical range). I have tried ...
Private Sub Worksheet _Change (ByVal Target As Excel.Range)
MsgBox "Range" & Target.Address & "Was Changed."
If Range ("B100").Value = "" Then
Application.Undo
MsgBox ("Do Not Insert or Delete Rows")
EndIf
End Sub.
The problem with the above is: The "Change" macro does not seem to detect the insertion of rows. It does, however, detect the deletion of rows.
I have a spreadsheet with data in 4 different sections with a summary section at the top. Data titles are in column A with the data to the right, arranged by month.
I have created macros to sort the data in each section. Occasionally I need to add a new row to each section for a new data set. When I do this, it screws up my sorting macros for the sections below. It will sort the same rows that it sorted before, not taking into account that the data is now one row lower.
Q1. How can we insert new rows in a protected sheet?
For example: In the attached sample protected excel sheet "insert rows.xlsx" , if for Employee ID and Name fields, the user has more no. of records than provided, how can he insert new rows considering the fact that Company ID and Name field are locked.
Or any way to address this issue via some other method like adding a scrollbar,etc.
I am working on a project of 4000+ entries. We will be identifying the number of seasons in a year. We would like to add a row in another worksheet for each of the seasons identified.
So say we had data in row 1 of worksheet 1. That row stated there were 3 seasons. Is there a way to automatically insert 3 rows into worksheet 2?
I have a need to insert formulas into a column using vba. I need to skip a row, when inserting the formulas, so a simple drag using vba would not work without some modification.
Here is the formula, that I need to insert... into column "BJ"
Example Cell BI11...=SUM(BH11-BH10)
Cell BI13...=SUM(BH13-BH12), the next cell needing a formula would be .. Cell BI15...
The formula would be inserted, based on the last row used in column "C".
click on cell A4 -right click - insert cell- shift to right, so figure 2 moves to C4 pushing the yellow cell to D4 right?
what am trying to do is to make column c to be frozen or locked or whatever you want to call it, so if I insert a cell in A4 shifting to the right, the value in B4 jumps to D4 without shifting the yellow cell
I've been using this code to make menus for all my Excel sheets since NateO made it back in 2003.
- The workbook has 370 sheets, 365 of them are one day per month with the tab named ddmmmyy. - The Main Menu in this file puts the months Jan, Feb, Mar, etc in cells A3:L3. - In the single cells under each month it put the month day tab name (ddmmmyy) and hyperlinks it to the sheet tab.
I would like to do two new things. 1. Put the name of the month in everyother cell in row 2, so Jan would be in A2, Feb in C2 and Mar in E2, etc. 2. Put the day of the week for each date in the cell to the right of the date. So the column heading would be Jan in A2, 01Jan08 in A3 and Tue in B3.
I thought I could make another macro and just insert the rows after the Main Menu was built and then VBA copy/paste TEXT(cell,"ddd") down the ranges, but thought there might be a better idea out there...
Sub Workbook_TOC() Dim ws As Worksheet Dim wsNw As Worksheet Dim z As Integer
Is it possible to make it so that a user cannot delete or add sheets to a work book, except through buttons assigned to macros? I've tried simply locking them, but these sheets need to be accessed to input and manipulate data. I have the macros necessary to delete/add sheets, but right now they are redundant since the user can simply do it manually.
I need to insert an arrow in a sheet, in a location and a direction which can be controlled by me (I don't mind hard coding the location and direction), based upon a cell value being positive, negitive or 0. I realise that it will require some code but can't find any infomation on doing anything like this through google or in the various VBA texts I own.
I have a command button that runs a macro to insert two new rows between row 15 and 16 no real problem (see code & sheet below), but I would like the Total Hours and Total Cost rows to include the newly added rows i.e.
Rows 16 & 17
Cell B18 now contains =B2+B4+B6+B8+B10+B12+B14+B16 and Cell B19 now contains =B3+B5+B7+B9+B11+B13+B15+B17
If another two rows are added then Total Hours and Total Cost Cells 20 & 21 will now be
Cell B20 now contains =B2+B4+B6+B8+B10+B12+B14+B16+B18 and Cell B21 now contains =B3+B5+B7+B9+B11+B13+B15+B17+B19
Command button Code to insert row
Code: Private Sub CommandButton1_Click() Const fWhat As String = "EXTERNAL" Dim sR As Range, fR As Range, fAdr As String, nRw As Long Set sR = Range("A1:C187")
I'd like to insert a picture background for multiple s/ sheets I've developed, however, even though the images I'm using are only 30kb's in size, it bumps my s/sheet file size from 900kb's to over 4mb's ! Is there a way I can stop this from happening, or, any way to restrict the background image to only a certain part of the worksheet as opposed to the entire thing?
When a user clicks a cell in Column A, VBA will enter the date in the cell (in the form MMDDYY) and will position the insertion pointer at the end of the date. The user can then enter a four digit number following the MMDDYY. In this worksheet, Column A holds a transaction number, which is always in the form MMDDYYXXXX. I am trying to save the user the trouble of entering the MMDDYY, since it will always be today's date.
I have a Workbook with about 20 Worksheets, for each sheet I have a Selection Change Event that simply performs the Following:
MainSheet1. Range(“Z1”) = Now
1 Cell on every Sheet then is pointed to this cell via =Main!Z1. Problem is that when this is preformed Each Row from the Other In-Active Sheets and sometimes a near-by Button will Appear on my Active Sheet. I cannot select the parts of the sheets that appear and when I scroll down till they are out of view and then scroll back up they are gone until I select another cell and it happens again. I have tried in the Z1 cell to just put =NOW() and Make Calculations Manual and then with the selection change to call MainSheet1.Calculate or Workbook.Calculate but this has the very same effect and the other sheets bleed onto or ghost onto my Active Sheet. So far the only way I’ve been able to get around this is:
If Application. ScreenUpdating Then Application.ScreenUpdating = False MainSheet1.Range(“Z1”) = Now Application.ScreenUpdating = True Else MainSheet1.Range(“Z1”) = Now End If...............
I need to insert text at the curson position in a text box on a VBA form. I know how to make the button not take the focus; I just need to know how to pass the cursor a timestamp.
Please find attached a daily copy of a spreadsheet that is used to monitor train running times.
The columns on the left - "Serv No, Serv Start Date,Train No:, Scheduled Arrival, Scheduled Depart" are provided to us automatically and the underlying cell formatting/formula cannot be changed. This information is cut directly from a daily report sent to us the previous day. The cell formatting for the start date is custom - dd-mm-yyyy hh:mm.
The sheet is usually locked out with user access only to the left hand side to cut and paste train times in and the input columns on the right hand side. User has no requirement to adjust any details in the left had column apart from to add additional trains at the bottom is need be. I have left the loaded sheet blank and complete with all underlying cell formatting, conditional formatting and formulas intact for you to play with.
Both sheets essentially do the same thing so whatever formula changes are made to the empty sheet can be adapted for the loaded sheet.
For simplicity, I will focus on the empty sheet. What I am mucking around with is having the user input the train arrival time in the "Actual Arrival" column - (column F)
What I am looking at then making occur is the spreadsheet automatically filling the adjacent columns with the appropriate text and calculations.
To do this excel needs to compare column the number (cell input is text formatted) as a number with the arrival time in column G. It then needs to calculate if the train is Early (16 minutes or more before scheduled arrival), on time (+/- 15 minutes either side of scheduled arrival) or late (16 minutes or more after scheduled). It then needs to automatically place the letter "E", "O" or "L" in column K and the time differential in column L.
My problem is two fold.
Firstly, I cannot seem to make the spreadsheet automatically enter a letter into column K depending on the above conditions.
Secondly, I have had limited success in having the spreadsheet compare column J with column F and working out the differential. However, this only works if the time remains linear. IE only if the train runs on time or late. It gives an incorrect time differential if the train is early. I will attach this spreadsheet tomorrow as an add on to this post.
I'm working on a employee evaluation form. I'm using a Pass/Fail system. I have a cell designated for PASS & one for FAIL. In these cells, I would put "YES" if they passed, "YES" if they failed that section. How can I prevent someone from mistakingly entering Yes in both cells?
I've generated a sheet where, based on the total run hours of a generator set using a given fuel type, we can determine which engine to run on what fuel when. The problem I've run into is that if more than one engine has the same runtime, the chart returns just the lowest numbered engine and eliminates the remaining engine(s). What I'm trying to do is make it so that when this occurs, the suggested engines show up in numerical order. For example instead of 1, 1, and 1 showing up on the chart, something like 1, 2, and 5 will show when they all have 0 run hours. I've attached my chart below with some engines having the same runtimes. RunOrder.xlsx
Is it possible to prevent the VBA window from popping up if an error occurs when running a macro and the user then selects debug? I've locked the code for reading but I was still able to change the code and save it!
Basically, I want the code to be unchangeable unless done through a known password. What I don't want is some user who may accidently stumble upon the code and change it unwittingly (or voluntary).
Is it possible to prevent a user from being able to move a userform around the screen area (clicking and holding caption bar)? I am captureing a image and using Pixels coordinates on the capture and need the userform to stay in the center of the screen or the image will not be catptured. The StartupPosition is center of screen, tried
I have an Excel 2007 file that is a work of art. Users manually copy several rows and columns from a table on a web page and paste it into my Excel file. This turns my beautiful Rembrandt into a Jackson Pollack mess. The formating of my cells is replaced with the formating from the web page. Is it possible to make the Excel file ignore the formatting of the data being copied? As a default?
If Not Intersect(Target, Range("h15")) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = "Ratio" Then If UF.Visible = False Then UF.Show End If Else If Target.Value = "Acid Test" Then Sheet2.Visible = xlSheetVisible Sheet1.Visible = xlSheetHidden Sheet2.Activate Application.Goto Sheet2.Range("A1"), _ Scroll:=True End If End If End If
The code works fine. However, if the target cell contains the word "Ratio", and the user opens the drop down menu in then cell and selects the work "Ratio" again, the userform displays. I only would like the userform to display if the cell went from being blank to "ratio" or from being another value to "ratio".
i would like the other tabs to be still visible to the user (so not hidden), but they should not be able to go to those sheets. (clicking on their name should so nothing)
I am using Excel to maintain a database for a computer game I'm playing. One of the things I'm using it for is to keep track of wages that I'm paying in the game. I do this by keeping the total potential wages in one column. As I only pay an employee when I use him, I then copy the wages over to the next column, where the total actual wages per event is calculated. However, when I copy the value from one column to the next (using the lack cross on the bottom right corner of the cell to drag it to the next) the value sometimes increases by one each time.
This isn't a major annoyance, but I'd like to find a way to prevent it happening at all. Does anyone know how to stop the increase?
*
A related issue that I experience is that sometimes when I copy or input a value in these columns, it brings up an error message saying "Number Entered As Text". Is there any way I can prevent this? Both these issues occur apparently regardless of formatting, and only on some of the cells, so I don't know quite why there's any problem at all.
I am trying to make a userform in my excel document that will allow the user to select (perhaps from a combo box) and delete a sheet they want. More sheets will be added and so the combo box or whatever should be able to reflect this. It should prevent them from deleting sheets I specify in the code as well. I've had a quick go doing this myself but I decided to start again as I had soo many problems. I think I just did it in a very long-winded fashion, so I would be interested to see what people come up with.
So I have this table... At the bottom of the table the Outer Fences. There is a column at the end of the table that calculates if the value in the row is outside the fences. I tried to do this by using the cell (say, H1500) in the if statement, but as I continued down the column I noticed that row 2 used H1500, row 3 used H1501, row 4 used H1502, and so on. So I have been just entering the new fence numbers as the data changes. Is there a way to go into the if statement and somehow "lock" the cell value so it doesn't change?
I've the following formula but some of the results are returning the #DIV/0! result I know I need to bring some logic into my formula to rectify this but am at a loss as to how to do this.