我有一个带有字符串的源excel,数量是9000行和20列,我需要将它们复制到新工作表,当我调试它时总是得到1004错误:
但是我确实需要Range可以变量....,所以这是可行的没有意义。
一些专家可以伸出援手吗?
答案 0 :(得分:1)
除了@RonRosenfeld指出的声明问题之外,您正在编写本质上难以调试的语句:
像
这样的事情class Board extends Component {
constructor(props){
super(props);
this.state = {
totalPosition: null
}
}
componentDidMount() {
this.props.dataStore.getSinglePlayer(1)
this.props.squareStore.getAllSquares()
}
componentWillReceiveProps(nextProps) {
if (
this.props.dataStore.currentPlayer !==
this.nextProps.dataStore.currentPlayer
) {
this.nextProps.dataStore.getSinglePlayer(1)
}
}
randomNumber() {
return Math.floor(Math.random() * 6) + 1
}
roll(playerId, playerPosition) {
let dice1 = this.randomNumber()
let dice2 = this.randomNumber()
let totalRoll = dice1 + dice2
this.setState({
totalPostion: totalRoll + playerPosition
});
let totalPosition = totalRoll + playerPosition
this.props.dataStore.changeUserPosition(playerId, totalRoll)
document.getElementById('dice').innerHTML =
'You rolled ' + totalRoll + '! You are now on ' + this.state.playerPostion
}
render() {
var player = {
name: '',
id: '',
position: 0
}
console.log(this.props.dataStore.currentPlayer)
if (this.props.dataStore.currentPlayer) {
var currentPlayer = this.props.dataStore.currentPlayer
player = {
name: currentPlayer.name,
id: currentPlayer.id,
position: currentPlayer.position
}
}
if (this.props.squareStore.squares) {
var squares = this.props.squareStore.squares.map((square, i) => {
var movement
if (i == player.position) {
movement = **
}
return (
<li key={i}>
<span>
{square.title}
<br />
{movement}
{square.price}
</span>
</li>
)
})
} else {
squares = <h4>Squares being loaded...</h4>
}
return (
<div>
<h1>Player: {player.name}</h1>
<h2>Roll Dice!</h2>
<button onClick={() => this.roll(player.id, player.position)}>
Roll
</button>{' '}
<h1 id="dice">{}</h1>
<div className="board">
<ul>{squares}</ul>
</div>
</div>
)
}
}
export default inject('dataStore', 'squareStore')(observer(Board))
难以调试,因为很难分辨出该语句的哪个部分导致了问题。将其分为3行(每行一个点运算符)并查看哪行首先失败:
Set tRng = ThisWorkbook.Worksheets(C_MY_Sheet_Backlog).Range("A2").Resize(G_FBP_RowNum - 7, 1)
这应该集中你的调试工作。中间Dim WS As Worksheet
Set WS = ThisWorkbook.Worksheets(C_MY_Sheet_Backlog)
Set tRng = WS.Range("A2")
Set tRng = tRng.Resize(G_F_RowNum - 7, 1)
几乎肯定不是问题所以你可能可以将最后两组合并为一组。我怀疑最后一个是。通常,这种将复合方法调用分解为更简单的方法调用的方法是一种有用的调试策略。
另外 - 不要使用Set
。它没有任何理由冒险溢出。请改用Integer
。