Click here to Skip to main content
16,004,192 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The user will select a date and corresponding name, and I would like to display that row or even highlight it well the sheet is open.

I have no idea how to do this. I have tried the select row function but that does not seem to do it. One sheet can have 100 records so now the have to page through it to see the one they want.

What I have tried:

I have tried the select row function, but it does not seem to do what I want.
Posted
Updated 20-Sep-22 7:41am

The best solution is born from knowing how to do it in Excel itself first. Vlookup or Match are excel specific functions that make this easy for you. Here is an article on this topic: Look up values with VLOOKUP, INDEX, or MATCH[^]

Note: this is the google search used to find this article: excel find a row in a column - Google Search[^]

There are many other links that discuss this in detail.

Once you understand how, via researching the topic, then you are armed with the knowledge to develop a solution.
 
Share this answer
 
// Is this the sheet selected
if (frmFoodPantry.theWorkbook.Sheets[i].Name == sheet)
{
// It was then show it
((Excel.Worksheet)frmFoodPantry.theWorkbook.Sheets[i]).Visible =
Excel.XlSheetVisibility.xlSheetVisible;
// Protect it so the user can not do edits to it
Excel.Sheets workSheet = frmFoodPantry.theWorkbook.Worksheets;
// Get the requested sheet
Excel.Worksheet theSheet = (Excel.Worksheet)workSheet.get_Item(i);
theSheet.Activate();
// Get the selected row for the selected date
string workingRange = "A" + rowIndex.ToString();
// Create the range for the selected date
Excel.Range rngWorkRow = theSheet.Range[workingRange];
// Highlight the entire row
rngWorkRow.EntireRow.Select();
// Protect the Work sheet
theSheet.Protect();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900