Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

Cell Formulas Won't Read Unless I Hit Enter

$
0
0

I have a WB with multiple sheets, most sheets have a data-validation dropdown list in cell A4 (for whatever reason there are a couple that are just text). What I’m trying to do seemed relatively easy, whatever sheet I am on, when I select a value from the dropdown list, it will update that value on all of the sheets (except for the 2 I excepted). So if I select “Tom” from sheet 3, and then go to sheet 5 “Tom” will also be selected there.

Using my clunky code, I have managed to get this to (kinda) work. The problem is that the cell formulas that reference this (vlookups mostly) do not read it. I have to go to cell A4 and click into the formula bar, and hit enter. Then the formulas will read it. I have been trolling message boards looking for solutions, but I’ve run out of ideas.

I’ve already:

-made sure autocalculation is on, made sure it isn’t text, made sure it isn’t circular

-made sure EnableCalculation is true (and also did true, then false, then true again), as well as application.calculate and tried various refreshes.

-I did the find a replace “=” of the formulas

I suspect that because the value is based on a variable (active-cell value), it’s got some kind of circular reference problem. In this latest version I tried to mitigate this by declaring it a variable and a string (too be honest, I’m grasping at straws), and before that I tried taking the active cell value, then copying and paste-special as just value. I am very, very new to VBA so I am probably missing something dumb. I would really appreciate any suggestions regarding what I’m missing, because I have really hit a wall regarding things I’ve seen on this and other forums.

My current code is follows:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)


 If Not Intersect(Target, Range("A4")) Is Nothing Then

 Call SetDropdown

 End If

End Sub

Sub SetDropdown()

    Dim ws As Worksheet
    Dim acv As String

    Application.ScreenUpdating = False
    Application.EnableEvents = False

    acv = ActiveCell.Value
    For Each ws In ThisWorkbook.Sheets
    If ws.Name <> ThisWorkbook.ActiveSheet.Name And ws.Name <> "TEAM LIST" Then

    ws.Range("A4") = acv

    End If
   Next ws

    Application.EnableEvents = True
    Application.ScreenUpdating = True


End Sub

Thank you in advance to anyone who can help point me in the right direction.


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>