菜鸟问题,简单之极,

fucool 2001-12-08 11:10:31
以下循换
For i = StartCol To EndCol
For j = StartRow To EndRow
If .GetCellInput(i, j, .GetCurSheet) = False Then
If .GetCellDataType(i, j, .GetCurSheet) = 2 Then
PDFstr1 = Trim$(.GetCellDouble(i, j, .GetCurSheet))
Else
PDFstr2 = Tstr + .GetCellString(i, j, .GetCurSheet)
End If
End If
Next
Next

要求,循换后,将PDFstr1,PDFstr2的值放到一字符串中应如何写。
并且,PDFstr1,PDFstr2有且只一个字符串输出。我头都大了
谢谢!!!!!!!!
...全文
97 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuyongg 2001-12-08
  • 打赏
  • 举报
回复
QQ:39464859
fucool 2001-12-08
  • 打赏
  • 举报
回复
两位有没有OICQ
xiaojian(萧剑)
xuyongg(懶漢) 
以后多指教
fucool 2001-12-08
  • 打赏
  • 举报
回复
多谢各位,谢谢!!!
fucool 2001-12-08
  • 打赏
  • 举报
回复
谢谢 xiaojian(萧剑

问题解决,错误出在"Tstr",已下是正确的代码

Dim StartCol As Long, EndCol As Long
Dim StartRow As Long, EndRow As Long
Dim PDFstr1 As String, PDFstr2 As String
Dim i, j, k, f
Static Tstr As String


Tstr = vbNullString '清空静态变量

With Me.Cell1
.GetSelectRange StartCol, StartRow, EndCol, EndRow
' .GetCurSheet

' On Error Resume Next
For i = StartCol To EndCol
For j = StartRow To EndRow
If .GetCellInput(i, j, .GetCurSheet) = False Then
If .GetCellDataType(i, j, .GetCurSheet) = 2 Then
Debug.Print Trim$(.GetCellDouble(i, j, .GetCurSheet))
PDFstr1 = Trim$(.GetCellDouble(i, j, .GetCurSheet))

Else
Debug.Print .GetCellString(i, j, .GetCurSheet)
PDFstr2 = .GetCellString(i, j, .GetCurSheet)
End If
End If
f = PDFstr1 + "," + PDFstr2
PDFstr1 = ""
PDFstr2 = ""
Tstr = Tstr + f
f = vbNullString
Next
Next


MsgBox Tstr '用于观擦数据,Tstr就是我要的数据。


.Invalidate
End With

飞天神笔 2001-12-08
  • 打赏
  • 举报
回复
To xuyongg(懶漢):
  你怎么知道其中肯定有一个字符串为空呢?根据程序来看,两个字符串都有值的可能性为99%。
xuyongg 2001-12-08
  • 打赏
  • 举报
回复
For i = StartCol To EndCol
'************************
PDFstr1=""
PDFstr2=""
'************************
For j = StartRow To EndRow
If .GetCellInput(i, j, .GetCurSheet) = False Then
If .GetCellDataType(i, j, .GetCurSheet) = 2 Then
PDFstr1 = Trim$(.GetCellDouble(i, j, .GetCurSheet))
Else
PDFstr2 = Tstr + .GetCellString(i, j, .GetCurSheet)
End If
End If
Next
Next
'************************
str=PDFstr1+PDFstr2
'************************
循环到最后,其中肯定有一个字符串为空,一个不为空,两个加在一起不就只剩一个不为空的了

飞天神笔 2001-12-08
  • 打赏
  • 举报
回复
问一下:
(1)你的要求看不懂,什么是“放到一个字符串中”(是合并这两个变量为另一个字符串变量吗),什么是“有且只一个字符串输出”(这不跟前面你说的有点矛盾吗)?是不是这个意思:最后生成一个新的字符串变量sNewStr,让sNewStr等于PDFstr1或者等于PDFstr2?
(2)中间的Tstr是什么变量,用来干什么的?
(3).GetCellInput()是什么函数?为什么要让它等于False?
xuyongg 2001-12-08
  • 打赏
  • 举报
回复
For i = StartCol To EndCol

For j = StartRow To EndRow
If .GetCellInput(i, j, .GetCurSheet) = False Then
If .GetCellDataType(i, j, .GetCurSheet) = 2 Then
PDFstr1 = Trim$(.GetCellDouble(i, j, .GetCurSheet))
Else
PDFstr2 = Tstr + .GetCellString(i, j, .GetCurSheet)
End If
End If
Next
Next

fucool 2001-12-08
  • 打赏
  • 举报
回复
在线等,高手请帮忙!!!!!
谢谢
fucool 2001-12-08
  • 打赏
  • 举报
回复
重新讲一遍

以下循换
For i = StartCol To EndCol
For j = StartRow To EndRow
If .GetCellInput(i, j, .GetCurSheet) = False Then
If .GetCellDataType(i, j, .GetCurSheet) = 2 Then
PDFstr1 = Trim$(.GetCellDouble(i, j, .GetCurSheet))
Else
PDFstr2 = Tstr + .GetCellString(i, j, .GetCurSheet)
End If
End If
Next
Next

要求,循换后,将PDFstr1,PDFstr2的值放到一字符串中应如何写。
并且,(PDFstr1,PDFstr2两个值)有且只一个字符串输出。我头都大了
谢谢!!!!!!!!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧