Document for Newsgroup

Location: http://www.mvps.org/dmcritchie/excel/docucells.htm      
Home page: http://www.mvps.org/dmcritchie/excel.htm
[View without Frames]

Text Documentation

Posting attachments to newsgroups is bad netiquette, an alternative is presented below which displays all content.
In reality you could post plain text as shown below the table.

 

A1:   	Description	
A2:   	pens	
A3:   	pencils	
A4:   	Total	
B1:   	dozens	
B2:   	3	
B3:   	2	
C1:   	price/doz	
C2:   	0.75	
C3:   	0.85	
D1:   	Total	
D2:   	=B2*C2	         Format: 0.00
D3:   	=B3*C3           Format: 0.00
D4:   	=SUM(D2:D3)      Format: 0.00
 
 ABCDE
1Description dozensprice/dozTotal =getformula(D1)
2pens30.75 2.25=B2*C2
3pencils20.85 1.70=B3*C3
4Total   3.95 =SUM(D2:D3)

     Descript unit  price Total Total
     pens        3  0.75  2.25  =B2*C2
     pencils     2  0.85  1.70  =B3*C3
     Total       -  ----  3.95  =SUM(D2:D3)

code

Sub DocuCells()
     Application.ScreenUpdating = False
     Application.Calculation = xlCalculationManual
     Dim Cell As Range, iRow As Long
     Dim wsNeww As Worksheet, wsCurr As Worksheet
     iRow = 0
     On Error Resume Next   'In case DocuCells sheet not exist
     Application.DisplayAlerts = False
     Worksheets("DocuCells").Delete
     Application.DisplayAlerts = True
     On Error GoTo 0
     Set wsCurr = ActiveSheet
     Worksheets.Add
     ActiveSheet.Name = "DocuCells"
     Set wsNeww = ActiveSheet
     wsCurr.Activate
     On Error Resume Next  'in case no selection with content
     For Each Cell In _
            Intersect(Selection, ActiveSheet.UsedRange)
       If Not IsEmpty(Cell) Then
         iRow = iRow + 1
         wsNeww.Cells(iRow, 1) = Cell.Address(0, 0) & ":   "
         wsNeww.Cells(iRow, 2) = "'" & Cell.Formula
         If Cell.NumberFormat <> "General" Then _
           wsNeww.Cells(iRow, 3) = "     Format: " & Cell.NumberFormat
       End If
     Next
     Application.Calculation = xlCalculationAutomatic
     Application.ScreenUpdating = True
     wsNeww.Select
End Sub

Related


This page was created on October 25, 2001.

Visit [my Excel home page]   [Index page]   [Excel Onsite Search]   [top of this page]

Please send your comments concerning this web page to: David McRitchie send email comments


Copyright © 1997 - 2004,  F. David McRitchie,  All Rights Reserved