跳转到帖子
在手机APP中查看

一个更好的浏览方法。了解更多

Chineseunb

主屏幕上的全屏APP,带有推送通知、徽章等。

在iOS和iPadOS上安装此APP
  1. 在Safari中轻敲分享图标
  2. 滚动菜单并轻敲添加到主屏幕
  3. 轻敲右上角的添加按钮。
在安卓上安装此APP
  1. 轻敲浏览器右上角的三个点菜单 (⋮) 。
  2. 轻敲添加到主屏幕安装APP
  3. 轻敲安装进行确认。

有没有会编写Excel VBA 语言的高手?

精选回复

求助...
怎么编写以下的程序?
column A x Coulmn B = Column C
例: Column A = Sales
Column B = Units
Column C = Total
==================
Sales Uints
$10.00 5
$15.00 6
$20.00 8
$35.00 9
$25.00 1
=======================================
column A 和 Coulmn B的行数不定,可以是10行,也可以是100行.
column C的值必需由大到小排列..
最终得出以下表格:
Sales Uints Total
$35.00 9 $315.00
$20.00 8 $160.00
$15.00 6 $90.00
$10.00 5 $50.00
$25.00 1 $25.00

请各路高手帮忙.
谢谢.
比如:columnA 在Excel 的A列, 起始行为1。columeB 在B 起始1,columnC 在C起始1。
在C1的网格里打:
=A1*B1
就可以得到你要的column A x Coulmn B = Column C
剩下的就是把C1复制然后粘贴到其他C列里,其他的C列就会复制C1中的公式然后计算出结果了。数值添加在编写公式之前或之后都可以。
至于你说的降幂排列的问题比较复杂,你再看看别人教你怎么做吧,正好我也学学,嘻嘻~!
  • 楼主
[quote name='吓吓~']由大到小排列的话,不是选中c列,然后点工具栏中的降序排列,就好了吗?![/QUOTE]
呵..我想知到用VBA语言该怎么写这个程序, 而不是具体的做法.....
[quote name='12345']呵..我想知到用VBA语言该怎么写这个程序, 而不是具体的做法.....[/QUOTE]

The Excel VBA macro code below can be used in any Excel Workbook. When run, it will sort the 1 dimensional array of strings, MyArray. It will output the unsorted array of values to A1:A10, then sort the array, then output the new sorted array of values to B1:B10. It should be noted that one could also output the array to an Excel Worksheet, sort using Excel's built in sort, then fill the array again with the sorted values. In this example, we use an array of text strings, but it could be an array of numeric values.

In the Excel macro code below outputs the array to a one column range with the help of the Transpose Worksheet Function. We could also output it to a one row range (without Transpose) like shown below;

Range(Cells(1, 1), Cells(1, UBound(MyArray))) = MyArray
To use the code, go to Tools>Macro>Visual Basic Editor (Alt+F11) and then to Insert>Module and paste in the code below.

Sub SortArray()
Dim MyArray(10) As String
Dim lLoop As Long, lLoop2 As Long
Dim str1 As String
Dim str2 As String

'Fill array
For lLoop = 0 To 9
If lLoop = 0 Then
MyArray(lLoop) = "Zoo"
Else
MyArray(lLoop) = Choose(lLoop, "Farm", "Paddock", "Sheep", _
"Cow", "Bird", "Mice", "Chicken", "Fence", "Post", "Lamb")
End If
Next lLoop

'Output unsorted array
Range("A1:A" & UBound(MyArray) + 1) = _
WorksheetFunction.Transpose(MyArray)


'Sort array
For lLoop = 0 To UBound(MyArray)
For lLoop2 = lLoop To UBound(MyArray)
If UCase(MyArray(lLoop2)) < UCase(MyArray(lLoop)) Then
str1 = MyArray(lLoop)
str2 = MyArray(lLoop2)
MyArray(lLoop) = str2
MyArray(lLoop2) = str1
End If
Next lLoop2
Next lLoop

'Output sorted array
Range("B1:B" & UBound(MyArray) + 1) _
= WorksheetFunction.Transpose(MyArray)

End Sub



[SIZE="4"][COLOR="DarkOrange"]像是放进一个array.然后对array sort.[/COLOR][/SIZE]

[url]http://www.ozgrid.com/VBA/sort-array.htm[/url]
  • 楼主
[quote name='lopenwing']网上讲不清楚,你在F的话,我可以帮你[/QUOTE]

呵呵,此话当真?我可以找个周末到F登门请教了.
可以把msn发给我吗?
谢谢
  • 楼主
[SIZE="4"][COLOR="DarkOrange"]像是放进一个array.然后对array sort.[/COLOR][/SIZE]

[url]http://www.ozgrid.com/VBA/sort-array.htm[/url][/QUOTE]

谢谢...
看得有点儿茫然.给你发短信了,请查看.

创建帐户或登录后发表意见

我的帐户

导航

搜索

搜索

配置浏览器推送通知

Chrome (安卓)
  1. 轻敲地址栏旁的锁形图标。
  2. 轻敲权限 → 通知。
  3. 调整你的偏好。
Chrome (台式电脑)
  1. 点击地址栏中的挂锁图标。
  2. 选择网站设置。
  3. 找到通知选项,并调整你的偏好。