+ Reply to Thread
Results 1 to 5 of 5

writing formulas in VB - referring to the values contained in cell

Hybrid View

  1. #1
    Josie
    Guest

    Re: writing formulas in VB - referring to the values contained in

    Thanks Udo, but it's not working. I have a friend who's relatively good at
    this stuff, and he can't figure out what's wrong either. Driving me CRAZY.

    "Udo" wrote:

    > Hi Josie,
    >
    > given your r1 through r4 are variables, the following should work:
    > Dim R1 As String
    > Dim R2 As String
    > Dim R3 As String
    > Dim R4 As String
    > Dim per1 As String
    >
    > R1 = "B4"
    > R2 = "H4"
    > R3 = "B8"
    > R4 = "H5"
    >
    > per1 = "=sum(" & R3 & ":" & R4 & ")/(sum(" & R1 & ":" & R2 & ")/100)"
    > ActiveCell.Formula = per1
    >
    > Good luck
    > Udo
    >
    >


  2. #2
    ers
    Guest

    Re: writing formulas in VB - referring to the values contained in

    Hi Josie,

    for few days I was looking for a way to reference in VBA a cell in
    another sheet.
    Only after I red this posting(s) I figure out the proper syntax. It
    wasn't working when the reference cell was in another workbook.
    The following is just to select a cell in sheet "c" knowing the column
    which is mentionated in a cell (A1) in sheet "a".
    Maybe will help in your situation.

    Sub findcell()
    Dim CN
    CN = ThisWorkbook.Sheets("a").Range("A1").Value
    '
    Sheets("c").Select
    Cells(1, CN).Select
    End Sub

    Good Luck
    emil


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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