• 0

[VBA] Macro Help!


Question

Here is a snippet of the code that I'm working with.. its simple.. go down a list of projects in latest_xreport sheet and compare values in columns on that row with another sheet (summary_sheet).. if the value in a given cell is not equal to each other in both sheets.. color cell in yellow (font - red) in the xreport sheet... It doesn't work :[... any thoughts? Really appreciate your help!

Sheets(latest_xreport).Select
lastrow = Range("A65536").End(xlUp).Row

	For j_count = 3 To lastrow

		For i_count = 10 To 23
			proj = Cells(j_count, 2).Value
			current_eval = Cells(j_count, i_count).Value

			Sheets(summary_sheet).Select
			new_eval_row = Cells.Find(proj).Row
			new_eval = Cells(new_eval_row, i_count).Value

			If current_eval <> new_eval Then
				Sheets(latest_xreport).Select
				Cells(j_count, i_count).Select
				ActiveCell.Interior.ColorIndex = 6
				ActiveCell.Font.ColorIndex = 3
			End If
		Next
	Next

Edited by .Ark
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Put a breakpoint on the first line (F9?) and step through the code (F8?), while keeping an eye of the variable values on each step.

Sorry, it's been a long while since I last touched VBA.

Link to comment
Share on other sites

  • 0
Put a breakpoint on the first line (F9?) and step through the code (F8?), while keeping an eye of the variable values on each step.

Sorry, it's been a long while since I last touched VBA.

Great idea.. didn't know how to do this before.. just starting to learn VBA haha.. it worked like a magic.. I realized that it was stuck on the summary_tab and was comparing results against the data on the summary_tab because the command to go into the xreport sheet is in the if loop so until there is a change it doesn't go in there.. Issue resolved.. thanks!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.