Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:30:34+00:00 2026-06-07T09:30:34+00:00

For the record, I’m using Excel 2010. I’m trying to teach myself VBA for

  • 0

For the record, I’m using Excel 2010.

I’m trying to teach myself VBA for a job at work (they give the interns the VBA stuff…), and I’m getting stuck on the simplest of things.

I am trying to make a bordered table that is three columns wide. The amount of rows in the table has to be based on the amount of inputs the user has. In my code, that is the value given for Count by the user.

My issue is that I have no idea how to select the range I need. The only way I know how to select a range is using:

ActiveCell.Range("Top left cell:Bottom right cell").Select

If it were from A1 to C8, how do I make that work? I wish it would just work like:

ActiveCell.Range("A1:C(count)").Select

This is what I have so far:

Option Explicit
Dim Count As Long
Dim CFLArray() As Variant
Sub TableCreation1()
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "Time (days)"
    ActiveCell.Offset(0, 1).Range("A1").Select
    ActiveCell.FormulaR1C1 = "CFL (measured)"
    ActiveCell.Offset(0, 1).Range("A1").Select
    ActiveCell.FormulaR1C1 = "De (estimated)"
    ActiveCell.Offset(0, -2).Range("A1:C1").Select
    Selection.Font.Bold = True
    ActiveCell.Columns("A:A").EntireColumn.EntireColumn.AutoFit
    ActiveCell.Offset(0,1).Columns("A:A").EntireColumn.EntireColumn.AutoFit
    ActiveCell.Offset(0,2).Columns("A:A").EntireColumn.EntireColumn.AutoFit
    ActiveCell.Select
End Sub

Sub FindRange()
    Range("A2").Select
    Count = InputBox("How many pairs of data do you have? ")
End Sub

I taught myself VBA a day or so ago using a book my work had, but I couldn’t find anything along these lines in there. My internet searches failed as well. The worst part is I know it’s going to be incredibly simple.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:30:37+00:00Added an answer on June 7, 2026 at 9:30 am

    It is that simple! You were just off by a little bit.

    Change: ActiveCell.Range("A1:C(count)").Select

    To: ActiveCell.Range("A1:C" & count).Select

    Though, I don’t see any count variable in your code.

    If you know that it’s always the same column, you could do this:

    Range("A1:C" & ActiveSheet.Range("C1048576").End(xlUp).Row).Select

    (1048576 is the max row in Excel 2010. This may not be perfect for your data, but hopefully it will get you started in the right direction…)

    Also, just as an added point about VBA, you don’t need to use Select in most cases. For example, this:

    Range("A1").Select
    
    ActiveCell.FormulaR1C1 = "Time (days)"
    

    Can be rewritten more simply as:

    Range("A1").FormulaR1C1 = "Time (days)"
    

    And if you are just using text:

    Range("A1").value = "Time (days)"
    

    I also want to point out that using ActiveCell.Range("A1:C" & count).Select is not the same as ActiveSheet.Range("A1:C" & count).Select. Depending on what cell is currently selected, these will select different ranges. If you really mean A1:C8, and not A1:C8 (relative to the current cell), then you’ll want to use the ActiveSheet (or omitted) version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're trying to record video to a Flash Media Server using a NetConnection object
I'm trying to record DELETE statements in a certain table using Oracle's auditing features.
Using active record, how can I return the results for a model if they
Im trying to record video using AVFoundation I can save images but not video.
I am trying to record video using AVFoundation. When I add video input only
I am trying to record audio by MediaRecorder, and I get an error, I
A record has been deleted from a CMS that I am using called ePublisher.
I am trying to record a 'time_in', and 'time_out' record on a model called
I'm trying to record a sample audio with phoneGap, but with no success. What
So have gotten to record in my F# journey and at first they seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.