Error If I Enter Wrong Criteria
Oct 27, 2008
The following code works like a dream for me, but if was to enter the wrong letter, not "N" or "R" and i tried to delete it, a debug message appears?
Is there a way to allow any letters to be deleted?
Here is my code
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 17 Then
With Range("C" & Target.Row & ":R" & Target.Row).Interior
Select Case Target.Value
Case "R": .Color = RGB(184, 204, 228)
Case "N": .Color = RGB(120, 120, 120)
Case Else: .Color = RGB(255, 255, 255)
End Select
End With
With Target.Font
Select Case Target.Value
Case "R": .Color = RGB(184, 204, 228)
Case "N": .Color = RGB(120, 120, 120)
Case Else: .Color = RGB(0, 0, 0)
End Select
End With
End If
End Sub
View 9 Replies
ADVERTISEMENT
Aug 31, 2007
My colleague and I are writing a udf which uses a "match/ index" combination to return a value to a cell from a named range in another sheet. The cell returns returns the error "value used in the formula is of the wrong data type". When we break down the code into a function which refers directly to the relevant cells, and a sub which returns the value in a message box, it works correctly: here's the code for the function and test sub:
Function MRL(PropertyType, ReturnType, Location, Year2) ....
View 7 Replies
View Related
Jun 30, 2013
I am trying to use FIND and an array formula to find the position of text in a range of cells (A2 and A3 in the example) which could be one of a number of options (C1:D1 here). But the array formula throws up the following error: "A value used in the formula is of the wrong data type". The simplest illustration of the problem is as follows. The formula in B2 is
Code:
{=FIND(($C$1:$D$1),A2)}
and $C$1:$D$1 contain REF and ATM respectively. [/CODE]
REF
ATM
203047 05AUG 08.55 OKEHAMPTON ATM
#VALUE!
CO-OP GROUP 380611 REF 191 7553375222 BCC
22
We see that B2 has a #VALUE! error - wrong data type. But for some reason B3 is ok returning 22!
View 9 Replies
View Related
Jan 20, 2014
=IF(AND(Weekly!$E4<>Admin!$E$2,Weekly!$E4<>Admin!$E$3),
COUNTIFS('Issue Log'!$A$2:$A$50,$A4,'Issue Log'!$B$2:$B$50,$B4,'Issue Log'!$C$2:$C$50,'Issue Log'!$C2,'Issue Log'!$D$2:$D$50,"<>"&"Completed",'Issue Log'!$D$2:$D$50,"<>"&"",'Issue Log'!$D$2:$D$50,"<>"&"Cancelled"),0)
WEEKLY
ResourceProjectContact ActivityStatusEst. TimeAct. Time # of Issues
Elaine W.PIPBA - Bonnie SchaferTESTIn Planning1
ISSUE LOG
ResourceProjectActivityIssue Status
Elaine W.PIPTESTCompleted
[code]....
View 3 Replies
View Related
Jun 18, 2009
Why is it that I recieve a #NUM! error when I enter a number (monthly payment) of 233 or less?
The formular I use is: =NPER(C79/12,-E79,D79)
Error:
C79 - 7%
D79 - 40000
E79 - 233
F79 - #NUM!
This works:
C79 - 7%
D79 - 40000
E79 - 234
F79 - 1008
View 13 Replies
View Related
Jan 10, 2014
I must have added a line of code like this in a VBA module a thousand times before and I have never got an error. The main code is run from the Worksheet Change event, which is ...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Enter_Container_Category
End Sub
Code:
Sub Enter_Container_Category()
With ActiveCell
Cur_Row = .Row
Cur_Col = .Column
End With
[Code] ..........
The error message I am getting is...
Run-time error '-2147417848 (80010108)':
Method 'Value' of object 'Range' failed.
View 3 Replies
View Related
May 4, 2007
I have attached a file called Test2 which has a public function called DBLookup. The function looks in the attached access database simulating a Vlookup just like in Excel. The problem I am having is when that data appears on sheet1. I am getting #VALUE in the cell and the erroe states "a used value in the formula is of the wrong data type".
my
Dim adoCN As ADODB.Connection
Dim strSQL As String
Const DatabasePath As String = "C:Test2.mdb"
'Function argument descriptions
'LookupFieldName - the field you wish to search
'LookupValue - the value in LookupFieldName you're searching for
'ReturnField - the matching field containing the value you wish to return...
View 5 Replies
View Related
Jul 31, 2014
I have some code I wrote that copies sheets from another sheet in another workbook to my current one, in order. However, depending on activity within these sheets, there might not be a sheet for the month.
I have the on error code to go to the next argument, however I would like it to tell me on my errors sheet that it did not exist.
The error sheet will simply have 2 columns of copied sheets and non-existent sheet.
VB:
On Error Resume Next
Workbooks("GLTemp").Sheets("981715").Copy After:=Workbooks("MHSGMR").Sheets("981715 Budget")
Workbooks("MHSGMR").Sheets("981715").Activate
sheetName = ActiveSheet.Name
Workbooks("MHSGMR").Sheets("981715").Select
ActiveSheet.Name = sheetName & " GL"
[Code] ......
View 3 Replies
View Related
Jul 24, 2008
Here's a sample of a completed table I would like to have.
Sheet2 *ABCDEFGHIJKL68*# ofSTART*wk #wk #wk #wk #wk #wk #wk #wk #69ACCTWEEKSWKRATE1234567870110181 $ * * * *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 71110242 $ * * * *10.00 * $ *10.00 $ *10.00 $ *10.00 $ *10.00 ***72120143 $ * * * *10.00 ** $ *10.00 $ *10.00 $ *10.00 $ *10.00 **73120272 $ * * * *10.00 * $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 74120381 $ * * * *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 75130151 $ * * * *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 $ *10.00 *** Excel tables to the web >> Excel Jeanie HTML 4
If given columns B and C, is there a VBA code that will look to those columns and auto-enter the payments across the week matrix based on that criteria?
View 19 Replies
View Related
Jul 10, 2009
I have been doing vlookups for ages and have never seen this error. The vlookup works in some columns but not in others.
View 9 Replies
View Related
Nov 8, 2009
I've got two columns with data. The first is text, and the second is numbers. So I want to be able to enter a certain criteria that would be contained in the text, and have excel return a list of the rows of text that contain that criteria and that have the highest 3 values in the corresponding column. I can use multiple cells to do this if need be (i.e. one cell for the text with the highest value, one for the second highest value, and a third for the next highest value).
View 4 Replies
View Related
Nov 19, 2008
In worksheet "Details" search down column "A" looking for any text/numbers. If there is something entered in the cell then look at column "M" for the same row and if that cell is empty inset "0%" in the cell.
Example:
Cell "A1" contains 12345. Cell "M1" is blank. The macro would inset 0% in "M1".
Cell "A2" contains 54321. Cell "M2" contain 40%. The Macro does not modify that row.
Cell "A3" is blank. The macro does not modify that row.
Cell "A4" contain 65478. Cell "M4" is blank. The macro would inset 0% in "M4".
View 9 Replies
View Related
Oct 11, 2009
I have a lil project, was wondering how to work this. I have several rows of numbers, thing is, they can only contain either a "1" or a "0" (zero). If anything else is entered other than a "1" or "0", I'd like to have a statement below it saying "Error - data must contain a 1 or 0" - or something similar.
I tried using conditional formatting - not working well.
View 2 Replies
View Related
Apr 2, 2007
I have about 20 files that all have separate passwords. When I enter the password for six of the files, I receive the "Unable to Read File" error message.
View 5 Replies
View Related
Jun 1, 2014
I really know nothing about vba so here goes. I would like to enter data in a row with 4 cells of info. then hit enter and return to the first cell and move the row down. all four cells must have data entered. and all four must move down. i tried some code as below i found and i modified but it did not work as expected. this moved the row down when returning the cursor to A2. It also should not copy the data style of the top row.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
Application.EnableEvents = False
[Code].....
View 4 Replies
View Related
Aug 15, 2008
This formula must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear.
View 3 Replies
View Related
Jul 4, 2013
I am puzzled with the following formula (entered with CTRL+SHIFT+ENTER) and it will not work. I get a error due to division by 0
{=SUM((MONTH(A$1:A$25)={1,2,3,11,12})*B$1:B$25)/SUM(MONTH(A$1:A$25)={1,2,3,11,12})}
My intention is to simply get an average of the values in column B if its respective row in column A is month # 1,2,3,11, or 12
A
B
1
01/15/2013
100
[Code] ......
Refer to the above table. Since A1, A2, A5, and A6 are having the months I seek, I then need Excel to use the values in B1,B2,B5, and B6 to offer me the average. In this case it should be (100+200+500+600)=1400 then divided by the number of occurrences column A had months that matched my criteria=4... so the final answer i would need is 1400/4 = 350
View 5 Replies
View Related
Jun 6, 2014
I have the following two columns in A1:B4 (customer # followed by percentage)
1 0.5
2 0.9
3 0.8
4 #DIV/0!
In column D i have a list of the customer #s. In column E i try to identify if the customer in column D have a percentage >=.8.
I am using the below formula, but getting a #DIV/0! error due to the error in cell B4, which i am not allowed to change using an iferror formula.
=SUMPRODUCT(--(A1:A4=D2),--(B1:B4>=0.8))
Is there a way to get around this using sumproduct or any other method to determine if the customer in D has a percentage >= 80%?
View 2 Replies
View Related
Apr 13, 2007
I am trying to define a dynamic range based upon error criteria. After the first error, all the subsequent cells are filled with the error and I would like to limit the named range to the rows with no errors (one column wide). I am thinking something similar to (realizing this is probably very wrong):
=OFFSET( 'Basin Routing'!$X$5,0,0, COUNTIF('Basin Routing'!$X:$X,AND(NOT(ISBLANK()),NOT(ISERROR()))),1)
View 4 Replies
View Related
Jun 13, 2013
VB:
Range("a1:n" & row_end).AutoFilter 13, "ABC"
If the value "ABC" not found in table, it shows error msg, In my file data="ABC" avail, sometimes not.
View 2 Replies
View Related
Mar 6, 2013
I have written a macro that prompts the user to chose some files and if they meet certain criteria, it copies them to a specified folder.However, I have run into this 424 error "Object required".
Code:
Sub FILES2SFTP()
Dim FileNames As Variant
Dim I As Integer
Dim fso As Variant
Dim Data As String
ChDrive "G:"
ChDir "G:TEST"
[code]....
The error is in this line:
If fso.getfilename(FileNames(I).Name) = ("Name1" & Data & ".xls" Or "Name2" & Data & ".xls") Then
View 2 Replies
View Related
Feb 17, 2009
I am using a For Each Next to cycle through a list of names, check certain conditions and then will be adding a further lookup (instead of Result = Result+1), but all I get is #Value!
Function maxbarometer(Name As String, Round As Integer, NameList As Variant, RoundRange As Range, RoundRangeTwo As Range)
Dim Roundname As String
Dim Result As Double
Dim NameColRound As Integer
Dim ListObject As Variant
Roundname = "Round " & Round
NameColRound = Application.WorksheetFunction.Match(Name, RoundRange, 0)
For Each ListObject In NameList
If ListObject.Value = Name Then
Result = Result
ElseIf Application.WorksheetFunction.VLookup(ListObject.Value, RoundRange2, NameColRound, False) = Roundname Then
Result = Result + 1
End If
Next
maxbarometer = Result
End Function
View 9 Replies
View Related
Mar 19, 2007
when i try to get the final row witht the following:
KROGrow = Cells(65536, 1).End(xlUp).Row
i am getting a row that is consistently 27 rows off of when i manually do control up? i am pasting data from and existing workbook into a newly created workbook in the sub. i would assume that since the destination is new that they would never be any data in this?
View 9 Replies
View Related
Jul 3, 2013
I am trying to use the Vlookup function to return State name based on the corresponding state code.
I have the list of State along with the Codes in adjacent sheet, arranged in ascending order. I am using the Vlookup function to list the State name based on the State code.
Vlookup function: Vlookup(A4,Sheet2.A2:B51,1)
This function returns me a wrong value. It gives "Arkansas" for the state code "AZ", when it should be Arkansas.
Also, if I add "FALSE" as a 4th argument, it returns "#N/A".
View 9 Replies
View Related
Jan 29, 2014
I have the following formula: IF(SELL_INVESTMENT = "YES" , 1,2) It returns not 1 or 2 but 0. The worksheet contains over 1000 cells. Trace Precedents verifies that the formula evaluates the correct cell and that it contains "yes". I created a very simple worksheet to test the formula and here it correctly returns 1.
View 2 Replies
View Related
Apr 18, 2014
When copying data from a website to excel, excel recognizes the dates wrongly.
About half of the dates he sees as: DD/MM/YYYY, while it should be: nothing/MM/DD.
For example: The cell contains the date: 01/04/2029 (The first of April, 2029)
While it should actually be: 04/29 (The 29th of April, no year!)
For all dates it starts with the 1, followed by a month, followed by a year (which consists of the year 2000 + the actual day), which is totally wrong.
About the other half of the cells, it just contains text with the month and the day (which are correct), but excel doesn't recognize this as a day.
For example: The cell contains the text: June 12
When I set the cell format to date (or any other format for that matter), nothing happens, so excel does not see this as a date.
View 1 Replies
View Related
Nov 7, 2008
I'm trying to figure out an Internal Rate of Return for a spreadsheet. The answer is supposed to be: 29.42% however I'm getting 25.94%. Does anyone know what I'm doing wrong in my IRR function on the Profitability worksheet? I'm currently using Excel 2007 by the way.
View 4 Replies
View Related
Feb 18, 2010
I have a problem with my references when sorting in excel. I have been searching for the problem, but did not found a useful solution.
I'm using excel 2003.
Let me try to explain my problem with a simple exampel.
I have a column with numbers and one with formulas pointing at these.
A B
2 =A1
4 =A2
3 =A3
Now I want to sort column A, and the column B should keep pointing at the original number. So I want this:
A B
2 =A1
3 =A3
4 =A2
But I get this:
A B
2 =A1
3 =A2
4 =A3
This output is what I would expect if I used absolut reference($).
Using offset(B1;0;-1) will work, but I cannot use this, since I will add/delete rows and the reference is not neccessarily next to it. Plus it can be a rather large sheet.
I cannot use dynamically name definition either, because it is intended for other users, and this will be too much work for them. What I basically need is a simple formula they can enter.
My sorting is done via a VBA macro, so if there is anything I can do through macro/VBA that will be okay as well, since I can do this without the user seeing it.
View 14 Replies
View Related
Oct 22, 2013
I have modified this micro I found in a forum. All I changed was the Range on Sheet 1.
[Code].....
It works fine except when it cuts to sheet 2 it starts at on column B I need it to start with Column C. What do I need to add ?
Attached File : Survey.xlsm
View 7 Replies
View Related
Sep 25, 2006
I have the following code which saves my worksheet with a name extracted from particular cells:
Public Sub SaveAsMaximoWO()
ThisFile = Range("AC5").Value
ThisFile2 = Range("E3").Value
saveName = ThisFile & " - " & ThisFile2
ActiveWorkbook.SaveAs Filename:=saveName
End Sub
This (for reasons I don't understand) saves the file to My Documents by default.
What I would like it to do is save to another folder within my documents as default.
View 14 Replies
View Related