-1

i have a working code to change the column values from string into general. that part works fine however it works only when the sheet tab is active in the workbook. Meaning the workbook is active, but the sheets tab (shTB) is not active, other tab is active, that doesn't change the value. if the sheet tab (shTB) is active, the value of the columns changes from string into General. here is my code

   If (ws.Name = "TB") Then
    shTB.Activate
    With shTB.Range("A:A")
        .NumberFormat = "General"
        .Value = .Value
    End With

this works but the main problem with this is that because i am activating the shTB, the page flash on and off, which is not nice user experience. any help or suggestion is highly appreciated!

braX
  • 11,506
  • 5
  • 20
  • 33
abraham foto
  • 437
  • 6
  • 16
  • 1
    The solution is simple. Stop relying on things like `Select` and `Activate` in your code. They are not needed if you write the code correctly. There are plenty of examples on this site that illustrate how to re-write the code. – braX Apr 06 '20 at 08:47

1 Answers1

1

Just remove the Activate line, and read this.

   If ws.Name = "TB" Then
    With shTB.Range("A:A")
        .NumberFormat = "General"
        .Value = .Value
    End With
SJR
  • 22,986
  • 6
  • 18
  • 26