我有一个excel文件,其中包含从另一台计算机上存储的文件中检索数据的单元格。我需要更新所有这些公式中的文件路径,但是每次更新公式时都会出现非常繁琐的问题,会出现一个打开的文件窗口。我要更改此位置的位置也不在我的计算机上。
有没有快速的方法来更新文件路径公式而不打开此对话框窗口?
我需要改变我的路径
=' \ clusfs001nas \
致:
=' R:\
答案 0 :(得分:5)
在"数据"选项卡,单击"编辑链接" - 这应该显示你链接到的文件,你可以"改变来源"更新它。或者,您可以执行简单的查找/替换(CTRL + F,然后单击"替换"并键入需要替换的路径,然后在替换区域中,放置新路径)。
答案 1 :(得分:2)
您可以使用VBA更改公式。
但首先,我建议您在只有一个单元格中使用它,并且在公式中,您添加此单元格,而不是真正的路径。这样,下次需要更改时,只更改一个单元格。
现在编码,改变A2和B5的例子:
Sub Change()
Range("A2").Formula = type the formula here between quotes
Range("B5").Formula = type the formula here between quotes
end sub
如果列中有大量单元格,则可以循环:
For i = 1 to 20 'say you have cells from row 1 to 20
Cells(i,3).Formula = type the formula here between quotes
'the number 3 above is the third column: C
next
答案 2 :(得分:0)
这很晚了,但是一个可以避免在单击“全部替换”时出现恼人对话框的选项是在路径的开头插入一些随机字符,这将阻止Excel认为字符串是实际的链接。然后,您应该能够编辑该路径中需要更改的部分,完成后,再执行一次全部替换,基本上删除插入的随机字符。
您当然需要小心,因为如果您选择的随机字符恰好位于其他公式中,则“全部替换”可能会产生一些意外结果
答案 3 :(得分:0)
你可以写在你的代码上:
import 'package:flutter/material.dart';
import 'MP_helper.dart';
import 'MP_Student.dart';
class AddStudentPage extends StatefulWidget {
const AddStudentPage({Key key}):super(key: key);
@override
_AddStudentPageState createState() => _AddStudentPageState();
}
class _AddStudentPageState extends State<AddStudentPage> {
final GlobalKey<FormState> _formStateKey = GlobalKey<FormState>();
Future<List<NewStudent>> mpStudents;
int mpStudentIdForUpdate;
String _mpStudentName;
String _mpStudentDepartment;
String _mpStudentDate;
bool isUpdate = false;
var _value1 = false;
var _value2 = false;
var _value3 = false;
MPHelper mpHelper;
DateTime mpPickedDate;
DateTime mpSelectedDate = DateTime.now();
final _mpStudentNameController = TextEditingController();
final _mpStudentDepartmentController = TextEditingController();
@override
void initState(){
super.initState();
mpHelper = MPHelper();
mpPickedDate = DateTime.now();
_mpStudentDate = mpPickedDate.toString().substring(0,10);
refreshMPStudentList();
}
refreshMPStudentList(){
setState((){
mpStudents = mpHelper.getNewStudents();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Students SQL'),
backgroundColor: Colors.blueAccent,
),
body: Column(
children: <Widget>[
Form(
key: _formStateKey,
autovalidateMode: AutovalidateMode.always,
child: Padding(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
child: Column(
children: <Widget> [
TextFormField(
validator: (value) => value.isEmpty
? 'Please Enter Student Name'
: null,
onSaved: (value) => _mpStudentName = value,
controller: _mpStudentNameController,
decoration: InputDecoration(
labelText: 'Student Name',
labelStyle: TextStyle(
color: Colors.blueAccent,
),
),
),
TextFormField(
validator: (value) => value.isEmpty
? 'Please Enter Department Name'
: null,
onSaved: (value) => _mpStudentDepartment = value,
controller: _mpStudentDepartmentController,
decoration: InputDecoration(
labelText: 'Student Department',
labelStyle: TextStyle(
color: Colors.blueAccent,
),
),
),
TextFormField(
validator: (value) => value.isEmpty
? 'Please Enter a Birthday Date'
: null,
decoration: InputDecoration(
labelText: "Date of Birth",
labelStyle: TextStyle(
color: Colors.black,
),
),
onTap: _mpPickDate,
controller: TextEditingController(text: mpPickedDate.toString().substring(0,10)),
),
Divider(
color: Colors.grey,
),
Center(
child: Text('Language'),
),
CheckboxListTile(
title: Text("Korean"),
value: _value1,
onChanged: (val){
setState(() {
_value1 = val;
});
},
controlAffinity: ListTileControlAffinity.leading,
),
CheckboxListTile(
title: Text("English"),
value: _value2,
onChanged: (val){
setState(() {
_value2 = val;
});
},
controlAffinity: ListTileControlAffinity.leading,
),
CheckboxListTile(
title: Text("Chinese"),
value: _value3,
onChanged: (val){
setState(() {
_value3 = val;
});
},
controlAffinity: ListTileControlAffinity.leading,
),
],
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget> [
RaisedButton(
color: Colors.blueAccent,
child: Text(
(isUpdate ? 'UPDATE':'ADD'),
style: TextStyle(color: Colors.white),
),
onPressed: () {
if (isUpdate) {
if(_formStateKey.currentState.validate()) {
_formStateKey.currentState.save();
mpHelper.update(NewStudent(mpStudentIdForUpdate, _mpStudentName, _mpStudentDepartment, _mpStudentDate)).then((data) {
setState(() {
isUpdate = false;
});
});
}
} else {
if(_formStateKey.currentState.validate()) {
_formStateKey.currentState.save();
mpHelper.add(NewStudent(null, _mpStudentName, _mpStudentDepartment, _mpStudentDate));
}
}
_mpStudentNameController.text = '';
_mpStudentDepartmentController.text = '';
_value1 = false; _value2 = false; _value3 = false;
refreshMPStudentList();
},
),
Padding(
padding: EdgeInsets.all(10),
),
RaisedButton(
color: Colors.red,
child: Text(
('CANCEL'),
style: TextStyle(color: Colors.white),
),
onPressed: () {
_mpStudentNameController.text = '';
_mpStudentDepartmentController.text = '';
_value1 = false; _value2 = false; _value3 = false;
setState(() {
//isUpdate = false;
mpStudentIdForUpdate = null;
});
},
)
],
),
const Divider(
height: 5.0,
),
Expanded(
child: FutureBuilder(
future: mpStudents,
builder: (context, snapshot) {
if(snapshot.hasData){
return generateList(snapshot.data);
}
if(snapshot.data == null || snapshot.data.length == 0) {
return Text("No Data Found");
}
return CircularProgressIndicator();
},
),
)
],
),
);
}
SingleChildScrollView generateList(List<NewStudent> mpStudents) {
return SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SizedBox(
width: double.infinity,
child: DataTable(
columns: [
DataColumn(
label: Text('NAME'),
),
DataColumn(
label: Text('DELETE'),
),
],
rows: mpStudents.map((mpStudent_table) => DataRow(
cells: [
DataCell(
Text(mpStudent_table.name),
onTap: (){
setState(() {
isUpdate = true;
mpStudentIdForUpdate = mpStudent_table.id;
});
_mpStudentNameController.text = mpStudent_table.name;
_value1 = false; _value2 = false; _value3 = false;
},
),
DataCell(
IconButton(
icon: Icon(Icons.delete),
onPressed: () {
mpHelper.delete(mpStudent_table.id);
refreshMPStudentList();
},
),
),
],
),
).toList(),
),
),
);
}
_mpPickDate() async {
DateTime date = await showDatePicker(
context: context,
initialDate: mpPickedDate,
firstDate: DateTime(1940),
lastDate: DateTime(2030),
);
if (date != null) {
setState(() {
mpPickedDate = date;
_mpStudentDate = mpPickedDate.toString().substring(0,10);
});
}
}
}