Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I still need help!
I have a slight problem that Excel either can not do or I can not ente the formula correctly. I am asking for your expertise. What I need i to enter Value A into a cell and then enter Value B into a cell, hav Excel do the division, and then generate a table with that number o rows. For example, if I enter "20" into cell A2, enter "5" into cel B2, I need Excel to generate a table in cell C5 that starts at 1 an then in cell D5 is 2, then 3 in cell E5, etc.... The number that I enter for the prompt "sections" is the number o columns that I need Excel to generate. I need Excel to do thi automatically (preferably without the user having to "click and drag anything. I have included an example output of what I need th spreadsheet to look like to, hopefully, help explain my idea. It is se up just like a spreadsheet; where the letters represent the columns the numbers (on the left) represent the rows. The blue numbers/letter represent the rows/columns of an Excel spreadsheet. The purple number are input by the user and the bold red numbers are the numbers that need Excel to generate & place. Code ------------------- A B C D E F G 1: 2: distance 20 3: sections 5 4: 5: * 1 2 3 4 5* 6: deltaX: (to be input by user, no code needed) ------------------- If you can help, please explain in as basic of terms as possible. Thank yo -- rbheda ----------------------------------------------------------------------- rbhedal's Profile: http://www.excelforum.com/member.php...fo&userid=2819 View this thread: http://www.excelforum.com/showthread.php?threadid=47843 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I still need help!
Hello Rbhedal, What you want to do with Excel is possible. The method maybe a littl more involved than you are used to, but I will walk through the steps. The input locations are based on your map, not what you wrote. Yo wrote "A2" but the map shows the input cell at "B2". The divisio result should be 4 not 5, unless there is something you didn't mentio (20/5 = 4). If any of this needs to changed, it is not a problem. INSTALLING THE MACRO 1)[/b] COPY ALL THE MACRO CODE IN THE CODE BOX BELOW USING *CTRL+ C*. *2)* BRING UP THE VBA WITH KEYS *ALT + F1 3)* SELECT THE PROJECT EXPLORER WINDOW USING KEYS *CTRL + 4)* PRESS THE *DOWN ARROW * TO SCROLL TO THE WORKSHEET THE MACRO WIL BE USED ON *5)* SELECT THE CODE PANE BY PRESSING *F [b]6)* Press *CTRL + V* to paste the Macro code into your project *7)* Press *CTRL + S* to save the changes That's it. You are ready to run automatically. If you have an questions or need further assistance contact me via emai . Sincerely, Leith Ross Code ------------------- Public Sub MyMacro() Dim N As Long Dim X As Long N = Range("B2").Value \ Range("B3").Value X = Range("1:1").Columns.Count Range("C5", Cells(5, X)).ClearContents For I = 1 To N Cells(5, 2 + I).Value = I Next I End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$3" Then Call MyMacro End Sub ------------------- -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=47843 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|