每次程序运行时都会向Excel表单添加一列 [英] adding a column to excel sheet everytime the program runs

查看:67
本文介绍了每次程序运行时都会向Excel表单添加一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



任何人都可以帮我这个吗?

我有一个excel工作簿...现在当我跑我的程序,在某个工作表的已用列的末尾添加一个新列,并在其中填充值....我无法弄清楚每次程序何时可以检测到哪个是最后使用的非空柱???作为模板将不会更新.....任何暗示?我应该在模板或代码中做些什么???



帮助将衷心感激.....: - )

Hello all,

Can anyone help me on this??
I have an excel workbook...now when i run my program, a new column is to be added at the end of used columns in a certain sheet and values are to be filled in it....i cant make it out how everytime the program can detect which is the last used non empty column??? as template won't be updated.....any hint on this??should i do something in the template or in the code???

help will be heartily appreciated.....:-)

推荐答案

hi


你可以用这个



with ******



Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1



结束



*****将是您正在处理的工作表

,你可以用行替换列来获得最后一个原始
hi
you can use this

with ******

Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1

end with

***** will be the sheet you are working on
and you can replace Columns with rows to get the last raw


你好吗?b $ b $ / b
你可以使用这个



with ******



Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1



结束



*****将是您正在处理的工作表

和您可以使用行替换列以获取最后一个原始
hi
you can use this

with ******

Dim lastcolumn As Integer = .UsedRange.Columns.Count + 1

end with

***** will be the sheet you are working on
and you can replace Columns with rows to get the last raw


这篇关于每次程序运行时都会向Excel表单添加一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆