设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1535|回复: 2
打印 上一主题 下一主题

[基础应用] 請幫忙解決表格問題

[复制链接]
跳转到指定楼层
1#
发表于 2005-3-2 23:56:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
把握公司常用表格在菜單上自動生成

在A1單元名稱生成工作表名稱

各位高人指導及幫忙解決





Sub 物品价格表() '吧台出售物品价格表

Range("A1").Value = "吧台出售物品价格表" '文字位置

Range("A2").Value = "序号"

Range("B2").Value = "名称"

Range("C2").Value = "原价"

Range("D2").Value = "单位"

Range("E2").Value = "价格"

Range("F2").Value = "差价"

Range("G2").Value = "毛利率"

Range("H2").Value = "备注"

'---------------------------------------------------------------------------

    Range("A3").Select '函數

    ActiveCell.FormulaR1C1 = "=IF(RC[1]="""","""",MAX(R[-1]C:R[-1]C)+1)"

    Selection.Copy

    Range("A3:A32").Select

    ActiveSheet.Paste

    Range("F3").Select '函數

    ActiveCell.FormulaR1C1 = "=IF(OR(RC[-3]="""",),"""",SUM(RC[-1]-RC[-3]))"

    Selection.Copy

    Range("F3:F32").Select

    ActiveSheet.Paste

    Range("G3").Select '函數

    ActiveCell.FormulaR1C1 = "=IF(OR(RC[-1]="""",),"""",SUM(RC[-1]C[-2]))"

    Selection.Copy

    Range("G3:G32").Select

    ActiveSheet.Paste

    '--------------------------------------------------------------------------

    Range("A1").Select '字體

    Selection.Font.ColorIndex = 3

    With Selection.Font

        .Name = "宋体"

        .Size = 20

        .Strikethrough = False

        .Superscript = False

        .Subscript = False

        .OutlineFont = False

        .Shadow = False

        .Underline = xlUnderlineStyleNone

        .ColorIndex = 5

    End With

    '-----------------------------------------------------------------------------

    Range("B3:B32").Select '下拉單

    With Selection.Validation

        .Delete

        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _

        xlBetween, Formula1:="咸干花生,鱿鱼丝,妙脆角,粟米脆,欢乐薯,烤鱼片,脆薯片,锅巴,怪味胡豆,夹心米果,喜之郎果冻,薛涛干,龙须牛肉,豆腐条,老川东牛肉干,遛洋狗牛肉干,手指饼,金帝巧克力,老城南牛肉粒,品客薯片,百草果,曼妥思,日式三文鱼,开心果,棒棒娃牛肉粒,清嘴含片,香香嘴豆腐干,煮土鸡蛋,甜粘玉米,火腿煎双蛋"

        .IgnoreBlank = True

        .InCellDropdown = True

        .InputTitle = ""

        .ErrorTitle = ""

        .InputMessage = ""

        .ErrorMessage = ""

        .IMEMode = xlIMEModeNoControl

        .ShowInput = True

        .ShowError = True

    End With

     '-----------------------------------------------------------------------------

    Range("D332").Select '下拉單

    With Selection.Validation

        .Delete

        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _

        xlBetween, Formula1:="包,个,根,套"

        .IgnoreBlank = True

        .InCellDropdown = True

        .InputTitle = ""

        .ErrorTitle = ""

        .InputMessage = ""

        .ErrorMessage = ""

        .IMEMode = xlIMEModeNoControl

        .ShowInput = True

        .ShowError = True

         '-----------------------------------------------------------------------------

    End With

    Range("A2,B2,C2,D2,E2,F2,G2,H2").Select '文字置中

    With Selection

        .HorizontalAlignment = xlCenterAcrossSelection

        .VerticalAlignment = xlCenter

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .IndentLevel = 0

        .ShrinkToFit = False

        .ReadingOrder = xlContext

        .MergeCells = False

    End With

    Range("A2:H2").Select

    With Selection.Interior

        .ColorIndex = 15

        .Pattern = xlSolid

     End With

      '-----------------------------------------------------------------------------

    Range("A1:H1").Select '合併

    With Selection

        .HorizontalAlignment = xlCenterAcrossSelection

        .VerticalAlignment = xlCenter

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .IndentLevel = 0

        .ShrinkToFit = False

        .ReadingOrder = xlContext

        .MergeCells = False

    End With

     '-------------------------------------------------------------------

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2005-3-3 02:16:00 | 只看该作者
为什么不用模板呢?
3#
发表于 2005-3-3 04:17:00 | 只看该作者
把菜单指定宏就可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2025-2-23 01:38 , Processed in 0.107759 second(s), 27 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表