Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a spreadsheet that users paste a report into and I want to make sure
the data are in the correct columns. (Many of the reports provided to my group have a similar layout, making it easy to make a mistake if you are not paying close attention.) Here is what I have: Sub FindCol() Sheets("Data").Select Range("A1").Select If ActiveCell.Value = "TC #" Then Range("F1").Select If ActiveCell.Value = "Dept #" Then Exit Sub Else MsgBox ("Incorrect Value in Cell " & Range(ActiveCell.Row & ":" & ActiveCell.Column)) End If End If End Sub Two issues: 1) The MsgBox is supposed to return the location of the incorrect cell, but I get a type mismatch error. What do I need to do to convert the range to a string? 2) Is there a better way to go about this? This works fine on two cells, but if I ever want to add more, it will become increasingly difficult. Thanks! PJ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet has numeric column headings. Change to alpha headings? | Excel Discussion (Misc queries) | |||
Column headings to numbers and row headings to alphabets? | Excel Discussion (Misc queries) | |||
Can I invert a table so row headings are now column headings etc | Excel Worksheet Functions | |||
In Excel how to make Column Values to Column Headings | Excel Programming | |||
compare data from one column with another and compare result to yet another | Excel Programming |