+ Reply to Thread
Results 1 to 5 of 5

Help with simple VBA coding

  1. #1
    Registered User
    Join Date
    03-08-2024
    Location
    Washington
    MS-Off Ver
    365
    Posts
    12

    Angry Help with simple VBA coding

    I am a NOVICE with VBA and coding. I am running into an error with code for a button I am trying to program. The button should check for the selected cell within Column A (A12 and below), then take a cell value from a specified range (from the selected cell within column A to 60 rows below) and display that value in cell B6. Any help would be great!

    Sub Check3sec()

    Dim rownumber As Integer
    rownumber = ActiveCell.Row
    If ActiveCell.Value <> "" Then
    Function MinValue()
    Range("B6") = WorksheetFunction.Min(Range("rownumber:rownumber+60"))
    End If

    End Function
    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Help with simple VBA coding

    As per explanation.
    Please Login or Register  to view this content.
    Experience trumps academics every day of the week and twice on Sunday.

  3. #3
    Registered User
    Join Date
    03-08-2024
    Location
    Washington
    MS-Off Ver
    365
    Posts
    12

    Re: Help with simple VBA coding

    I tried that, but I am getting a debug issue with "If .Column = 1 And .Row > 11 Then"

    Any thoughts as to why?

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Help with simple VBA coding

    You can't have a function/sub nested within another. Notice that your End If belongs outside of the function.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by protonLeah; 03-08-2024 at 11:19 PM.
    Ben Van Johnson

  5. #5
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    204

    Re: Help with simple VBA coding

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with coding of this simple calculator
    By Stona in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2020, 04:50 AM
  2. Need help with fairly simple VBA coding
    By JackCarter in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2016, 10:50 AM
  3. [SOLVED] Simple If Then Else Coding
    By Adam Schaefer in forum Excel General
    Replies: 2
    Last Post: 12-12-2014, 01:18 PM
  4. Simple Moving Averages & VB Coding
    By ashleys.nl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2012, 08:34 PM
  5. some simple coding help needed
    By PatSabre12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2011, 12:53 PM
  6. Simple subtraction and color coding ?
    By needtolearn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2006, 07:40 PM
  7. Simple coding in Excel
    By craigs in forum Excel General
    Replies: 1
    Last Post: 01-17-2006, 02:55 PM

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