0

I need a spreadsheet to be sorted in order to perform a calculation.

I've tried different code, and get an unspecified error. The newest code I have also does the same. I know the bug is here, since code runs fine when I take it out. Here's the current code:

inputws.Columns("A:M").Sort key1:=Range("G2"), order1:=xlAscending, Header:=xlYes

I need column G to be in ascending order and of course, have the other columns comply as well. Yet, this is giving me errors.

I've also tried unsorting before running the code (so the code can then sort it) and still get an error.

Carlos Andres
  • 69
  • 1
  • 8
  • And the error is? At a first glance, you should probably specify the worksheet for `Range("G2")`. – BigBen May 19 '21 at 17:20
  • @BigBen, I have no idea! Literally I just get "Unspecified Error.' and after I press the stop button. I corrected what you pointed out and still get the same issue. Mouse pointer also gets weird, and starts blinking. Like the code gets into some infinite loop. – Carlos Andres May 19 '21 at 17:27

1 Answers1

0

Fixed:

inputws.Columns("A:M").Sort key1:=inputws.Range("G1"), order1:=xlAscending, Header:=xlYes
Carlos Andres
  • 69
  • 1
  • 8