+ Reply to Thread
Results 1 to 3 of 3

Expand Columns (rows) from looking into second worksheet

  1. #1
    Registered User
    Join Date
    04-04-2009
    Location
    Jupiter, Jupiter
    MS-Off Ver
    Excel 2003
    Posts
    2

    Expand Columns (rows) from looking into second worksheet

    Hi,

    I want to create a Worksheet2 (called "Kalc") which depends on Worsksheet1 (called "Mastert"emplate) recieves user input. There are two components I need to work on: (1) expand/contract column numbers (minimum 30 to 64) which receives variable attributes from Worksheet1, and (2) fill the appropriate equations for later computation.(This I still have to work on..so not a problem at this juncture. Thanks.)

    I am attaching Worksheet (Excel File contains macro) plus a PDF file in case Spreadsheet is not allowed.

    The top image is from Worskheet1 ("Mastert"), and creats appropriate fields based on variables supplied from Worksheet1. Things I need is to:
    (a) Increase or Decrease Columns based on numbers found in Mastert $N3:$N13, (b) Appropriate column values, say if $N4 = 2, then it creates 2 Columns with Values from $F4 "Ref 5mpk 8hrs" and Color = Dark Pink.

    Can anybody guide me? Thanks a bunch in advance.

    S
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Expand Columns (rows) from looking into second worksheet

    Hi
    try the macro with different values in col N of mastert.
    Ravi
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-04-2009
    Location
    Jupiter, Jupiter
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Expand Columns (rows) from looking into second worksheet

    Ravishankar, Thanks for you for almost ready macro in VB. Leaving one (or may be two) requirement, the macro worked as expected. This leaving to almost 99.95% allowed me to practice and learn, and understand the algorithm. This was very, very useful to me because, you see.., I am a newbie in programming in general, and neu newbie in VB altogether.

    I am attaching the macro that worked for me after adjusting Error 99 (Invalid use of Null).(entered below in red fonts) (took me one hour to figure out)


    Now I will work on equations that fill the cells underneath each of the Expt number.
    -------------------------------------------------------
    Sub colours()
    Dim a As Long, c As Long, d As Long, e As Long
    Dim b As String
    d = 2
    For a = 3 To 13 'Go down the rows from 3 onward upto 13
    b = Sheets("Mastert").Cells(a, 14) 'select cell value in column N (14)
    e = Choose(a, 1, 2, 2, 38, 40, 36, 35, 34, 37, 39, 44, 6, 4) 'Ascribe color code for the cell
    If b > 0 Then
    For c = 1 To b
    Sheets("kalc").Cells(3, d) = Sheets("Mastert").Cells(a, 6)
    Sheets("kalc").Cells(3, d).Interior.ColorIndex = e
    d = d + 1
    Next c
    End If
    Next a
    MsgBox "Complete"
    End Sub

+ 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