+ Reply to Thread
Results 1 to 1 of 1

Excel 2007 : VB doesn't read the data from the cells in excel.Help!!

Hybrid View

  1. #1
    Registered User
    Join Date
    08-26-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    1

    Unhappy VB doesn't read the data from the cells in excel.Help!!

    VB does not read the data from the cell which is imported automatically via excel formula



    I wrote the following code, to change the colour of the autoshape based on the entered number into cell B42, which it works fine when I manually type in 1,2 or 3.

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Not Intersect(Target, Range("B42")) Is Nothing Then
    If IsNumeric(Target.Value) Then
    If Target.Value = 1 Then
    ActiveSheet.Shapes("Freeform 377").Fill.ForeColor.RGB = vbGreen
    ElseIf Target.Value = 2 Then
    ActiveSheet.Shapes("Freeform 377").Fill.ForeColor.RGB = vbYellow
    ElseIf Target.Value = 3 Then
    ActiveSheet.Shapes("Freeform 377").Fill.ForeColor.RGB = vbRed
    End If
    End If
    End If
    End Sub

    But B42 actually shows result of a calculation. In the other word this cell shows the result of the formula which is assigned to it.

    The problem is the data which goes to B42 are still 1,2 or 3 which are automatically generated by the excel formula but when data goes to cell B42 automatically rather than Manually VB doesn't run and colours do not change.

    Does anyone know how to fix it? or is there anyway to put a button to refresh the cell?

    I would appreciate if someone help me with that.

    Thanks,
    Dave
    Last edited by zardaloo; 08-27-2010 at 05:43 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1